Superclass of float


#1

Hi,
I want to avoid to write redundant code. I. e. I want to offer a function for f32 and f64, but only for those two.

pub fn foo(weights: &Vec<f64>)

And I need another implementation:

pub fn foo(weights: &Vec<f32>)

Is there a possiblity to write code like

pub fn foo<T: Float>(weights: &Vec<T>)

in order to avoid redundancy?


#2

You are probably looking for http://rust-num.github.io/num/num/trait.Float.html in num crate.