3 ms·
Sounds like a good use of Num [1] https://docs.rs/num-traits/latest/num_traits/trait.Num.html https://docs.rs/num-traits/latest/num_traits/trait.Num.html
by bionhoward 1y ago
Sounds like a good use of Num
[1] https://docs.rs/num-traits/latest/num_traits/trait.Num.html https://docs.rs/num-traits/latest/num_traits/trait.Num.html
- lynndotpy 1y agoPlease correct me if I'm wrong, but I don't think this would let me, say, pass an i32 returned from one method directly as an f64 argument in another method.
- at_compile_time 1y agoNo, it would not. Even conversions using "as" are discouraged in favor of conversion traits such as From and TryFrom. Rust's goals of being explicit and correct are at odds with people wanting things to be immediately simple and easy to use.