dsalgo 0.3.10

A package for Datastructures and Algorithms.
Documentation
//! inspired by numpy.flatnonzero

use crate::convert_to_bool::ToBool;

pub fn flat_nonzero<T: ToBool>(a: &[T]) -> Vec<usize> {
    a.iter()
        .enumerate()
        .filter_map(|(i, x)| if x.to_bool() { Some(i) } else { None })
        .collect()
}

#[cfg(test)]

mod tests {

    #[test]

    fn test() {}
}