How to use generics with float types and UFCS? I’ve seen the num-traits crate and tried it, and it works fine until I want to use UFCS with a primitive type. For instance, in the code,
let a = f64::floor( b * 275.0 + c );
However, I cannot replace the f64 with the generic type
T. I understand I should be able to do,
let a = ( b * 275.0 + c).floor();
and get the same result, but the former seems more straight forward from a math perspective and easier to read and understand the intent. Is there anyway I can use generics with the module system so I can do it the first way with a generic float type instead of just f64?
Maybe a way I haven’t thought of to use
macro_rules to interact with the modules and get the desired behavior?