Trait std::iter::OrdIterator

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.

Required Methods

fn max(&mut self) -> Option<A>

Consumes the entire iterator to return the maximum element.

Example

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.

Example

let a = [1, 2, 3, 4, 5];
assert!(a.iter().min().get() == &1);

Implementors