Function sknife::collection::any [] [src]

pub fn any<T, F, I>(predicate: F, list: I) -> bool where
    F: FnMut(T) -> bool,
    I: Iterator<Item = T>,
    T: Clone

Find if any element of list satisfies the predicate

Arguments

  • predicate - The predicate function
  • list - A list of elements to find in

Example

use sknife::collection::any;
let list = vec![1, 2, 3, 4];
let greater_than_one = |x: i32| x > 1;
any(greater_than_one, list.into_iter());
 

Result

true;