Superclass of float


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?


You are probably looking for in num crate.