fera_fun

Function position_of

Source
pub fn position_of<I, T>(iter: I, item: &T) -> Option<usize>
where I: IntoIterator, I::Item: Borrow<T>, T: PartialEq,
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));