is_sorted

Function is_sorted 

Source
pub fn is_sorted<T: PartialOrd>(slice: &[T]) -> bool
Expand description

Checks if the elements of the slice are sorted.

That is, for each element a and its following element b, a <= b must hold. If the slice contains exactly zero or one element, true is returned.

Note that if T is only PartialOrd, but not Ord, the above definition implies that this function returns false if any two consecutive items are not comparable.