pub fn filter_values<F>(&self, filter_fn: F, limit: Option<usize>) -> Vec<T>
        where F: Fn(&(&String, &T)) -> bool
    {
        let mut results = Vec::<T>::new();

        let mut counter = 0;
        let max_items = limit.unwrap_or(self.data.len());

        for (k, _) in self.data.iter().filter(filter_fn) {
            if let Some(cloned) = self.get_cloned(k) {
                results.push(cloned);
                counter += 1;
            }

            if counter >= max_items {
                break;
            }
        }

        results
    }
// TODO: maybe make version of this without cloning
// todo: or replace this functionality with an iterator with an fn iter().take()
maybe make version of this without cloning
todo: or replace this functionality with an iterator with an fn iter().take()
maybe make version of this without cloning todo : or replace this functionality with an iterator with an fn iter () . take ()
pub fn filter_values<F>(&self, filter_fn: F, limit: Option<usize>) -> Vec<T>
        where F: Fn(&(&String, &T)) -> bool
    {
        let mut results = Vec::<T>::new();
        let mut counter = 0;
        let max_items = limit.unwrap_or(self.data.len());
        for (k, _) in self.data.iter().filter(filter_fn) {
            if let Some(cloned) = self.get_cloned(k) {
                results.push(cloned);
                counter += 1;
            }
            if counter >= max_items {
                break;
            }
        }
        results
    }
pub fn filter_values < F > ( & self , filter_fn : F , limit : Option < usize > ) -> Vec < T > where F : Fn ( & ( & String , & T ) ) -> bool { let mut results = Vec :: < T > :: new ( ) ; let mut counter = 0 ; let max_items = limit . unwrap_or ( self . data . len ( ) ) ; for ( k , _ ) in self . data . iter ( ) . filter ( filter_fn ) { if let Some ( cloned ) = self . get_cloned ( k ) { results . push ( cloned ) ; counter += 1 ; } if counter >= max_items { break ; } } results }
TODO: maybe make version of this without cloning
todo: or replace this functionality with an iterator with an fn iter().take()
TODO : maybe make version of this without cloning todo : or replace this functionality with an iterator with an fn iter () . take ()
&self
filter_fn
F
limit
Option<usize>
&self
filter_fn
F
limit
Option<usize>