pub trait OrdIterator<A> { fn max(&mut self) -> Option<A>; fn min(&mut self) -> Option<A>; }
A trait for iterators over elements which can be compared to one another.
The type of each element must ascribe to the Ord
trait.
fn max(&mut self) -> Option<A>
Consumes the entire iterator to return the maximum element.
let a = [1, 2, 3, 4, 5];
assert!(a.iter().max().get() == &5);
fn min(&mut self) -> Option<A>
Consumes the entire iterator to return the minimum element.
let a = [1, 2, 3, 4, 5];
assert!(a.iter().min().get() == &1);
impl<A: Ord, T: Iterator<A>> OrdIterator<A> for T
Prefix searches with a type followed by a colon (e.g.
fn:
) to restrict the search to a given type.
Accepted types are: fn
, mod
,
struct
(or str
), enum
,
trait
, typedef
(or
tdef
).