[][src]Struct misc_utils::Max

pub struct Max<T> { /* fields omitted */ }

Helper type to ensure to calculate a maximal value

Methods

impl<T> Max<T> where
    T: Copy + Ord
[src]

pub fn new() -> Self[src]

Create a new instance

pub fn with_initial(initial: T) -> Self[src]

Create a new instance with an initial value to compare to

pub fn get_max(&self) -> Option<T>[src]

Return the maximal value found so far

Returns None if neither an initial value exists nor update was called. Returns Some(T) if at least one value exists.

pub fn get_max_extreme(&self) -> T where
    T: Bounded
[src]

Return the maximal value found so far

This method falls back to the minimal value for type T, if no other value exists.

pub fn update<V: Into<Self>>(&mut self, value: V)[src]

Update the value by replacing it with a higher value

If value is greater than self, then self is replaced with value. This method can be called with type T or type Max<T>.

Trait Implementations

impl<T: Eq> Eq for Max<T>[src]

impl<T: Clone> Clone for Max<T>[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<T: Copy> Copy for Max<T>[src]

impl<T: PartialOrd> PartialOrd<Max<T>> for Max<T>[src]

impl<T: PartialEq> PartialEq<Max<T>> for Max<T>[src]

impl<T> Default for Max<T>[src]

impl<T: Ord> Ord for Max<T>[src]

fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the minimum of two values. Read more

impl<T> From<T> for Max<T> where
    T: Copy + Ord
[src]

impl<T: Hash> Hash for Max<T>[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl<T> FromIterator<T> for Max<T> where
    T: Ord
[src]

impl<T: Debug> Debug for Max<T>[src]

impl<T> Display for Max<T> where
    T: Display
[src]

impl<T> FromStr for Max<T> where
    T: Copy + FromStr + Ord
[src]

type Err = T::Err

The associated error which can be returned from parsing.

Auto Trait Implementations

impl<T> Send for Max<T> where
    T: Send

impl<T> Sync for Max<T> where
    T: Sync

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]