vec-utilities 0.0.2

A collection of methods that make working with Vecs of floats easier
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
pub trait Filters<T> {
    fn filter_nans(&self) -> Vec<T>;
}

macro_rules! impl_filter {
    ($float:ty) => {
        impl Filters<$float> for Vec<$float> {
            fn filter_nans(&self) -> Vec<$float> {
                return self.iter().cloned().filter(|x| !x.is_nan()).collect();
            }
        }
    };
}

impl_filter!(f32);
impl_filter!(f64);