pub fn member<T>(s: &[T], m: T) -> Option<usize> where
T: PartialOrd<T> + Copy,
Expand description
Finds the first occurence of item m
in slice s
by full iteration.
Returns Some(index)
to the slice or None
(when it has gone to the end).
Note that it uses only partial order and thus accepts any item that is neither
greater nor smaller than m
(equality by default).
Suitable for small unordered sets.
For longer lists or repeated membership tests, it is better to
index sort them and then use faster binary memsearch
(see below).