pub fn maximum_by<F>(&self, compare: F) -> &T
    where
        F: Fn(&T, &T) -> Ordering,
    {
        let mut max = &self.0;
        for i in self.1.iter() {
            max = match compare(&max, &i) {
                Ordering::Equal => max,
                Ordering::Less => &i,
                Ordering::Greater => max,
            };
        }
        max
    }
/// Returns the element that gives the maximum value with respect to the specified comparison function.
///
/// This will return the first item in the vector if the tail is empty.
///
/// # Examples
///
/// ```
/// use nonempty::NonEmpty;
///
/// let non_empty = NonEmpty::new((0, 42));
/// assert_eq!(non_empty.maximum_by(|(k, _), (l, _)| k.cmp(l)), &(0, 42));
///
/// let non_empty = NonEmpty::from(((2, 1), vec![(2, -34), (4, 42), (0, 76), (1, 4), (3, 5)]));
/// assert_eq!(non_empty.maximum_by(|(k, _), (l, _)| k.cmp(l)), &(4, 42));
/// ```
Returns the element that gives the maximum value with respect to the specified comparison function.
This will return the first item in the vector if the tail is empty.
Returns the element that gives the maximum value with respect to the specified comparison function . This will return the first item in the vector if the tail is empty .
pub fn maximum_by<F>(&self, compare: F) -> &T
    where
        F: Fn(&T, &T) -> Ordering,
    {
        let mut max = &self.0;
        for i in self.1.iter() {
            max = match compare(&max, &i) {
                Ordering::Equal => max,
                Ordering::Less => &i,
                Ordering::Greater => max,
            };
        }
        max
    }
pub fn maximum_by < F > ( & self , compare : F ) -> & T where F : Fn ( & T , & T ) -> Ordering , { let mut max = & self . 0 ; for i in self . 1 . iter ( ) { max = match compare ( & max , & i ) { Ordering :: Equal => max , Ordering :: Less => & i , Ordering :: Greater => max , } ; } max }
Returns the element that gives the maximum value with respect to the specified comparison function.
Returns the element that gives the maximum value with respect to the specified comparison function .
&self
compare
F
&self
compare
F
examples
```
use nonempty::NonEmpty.




` ` ` use nonempty :: NonEmpty .