Skip to main content

ArrayMax

Trait ArrayMax 

Source
pub trait ArrayMax<T, const N: usize>: Array<T, N> {
    // Provided methods
    fn max_element_by<F>(&self, compare: F) -> &T
       where F: FnMut(&T, &T) -> Ordering { ... }
    fn max_element_by_key<F, K>(&self, f: F) -> &T
       where F: FnMut(&T) -> K,
             K: Ord { ... }
    fn max_element_mut_by<F>(&mut self, compare: F) -> &mut T
       where F: FnMut(&T, &T) -> Ordering { ... }
    fn max_element_mut_by_key<F, K>(&mut self, f: F) -> &mut T
       where F: FnMut(&T) -> K,
             K: Ord { ... }
    fn max_element(&self) -> &T
       where T: PartialOrd { ... }
    fn max_element_mut(&mut self) -> &mut T
       where T: PartialOrd { ... }
    fn max_element_idx(&self) -> usize
       where T: PartialOrd { ... }
}

Provided Methods§

Source

fn max_element_by<F>(&self, compare: F) -> &T
where F: FnMut(&T, &T) -> Ordering,

Source

fn max_element_by_key<F, K>(&self, f: F) -> &T
where F: FnMut(&T) -> K, K: Ord,

Source

fn max_element_mut_by<F>(&mut self, compare: F) -> &mut T
where F: FnMut(&T, &T) -> Ordering,

Source

fn max_element_mut_by_key<F, K>(&mut self, f: F) -> &mut T
where F: FnMut(&T) -> K, K: Ord,

Source

fn max_element(&self) -> &T
where T: PartialOrd,

Source

fn max_element_mut(&mut self) -> &mut T
where T: PartialOrd,

Source

fn max_element_idx(&self) -> usize
where T: PartialOrd,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<S, T, const N: usize> ArrayMax<T, N> for S
where S: Array<T, N>,

Assuming the size N != 0