[][src]Struct misc_utils::Max

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

Helper type to ensure to calculate a maximal value

Implementations

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: Clone> Clone for Max<T>[src]

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

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

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

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

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

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

impl<T> FromIterator<T> for Max<T> where
    T: Ord
[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.

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

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

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

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

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

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

Auto Trait Implementations

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

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

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

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

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

Blanket Implementations

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

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

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

impl<T> From<!> for T[src]

impl<T> From<T> for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.