Function fera::fun::position_of

source ·
pub fn position_of<I, T>(iter: I, item: &T) -> Option<usize>where
    I: IntoIterator,
    <I as IntoIterator>::Item: Borrow<T>,
    T: PartialEq<T>,
Expand description

Returns the first position of an item of an iterator or None if the iterator does not produces the item.

use fera_fun::position_of;

assert_eq!(Some(1), position_of(&[0, 3, 3, 0, 5], &3));