Struct misc_utils::Max
source · [−]pub struct Max<T> { /* private fields */ }
Expand description
Helper type to ensure to calculate a maximal value
Implementations
sourceimpl<T> Max<T> where
T: Copy + Ord,
impl<T> Max<T> where
T: Copy + Ord,
sourcepub fn with_initial(initial: T) -> Self
pub fn with_initial(initial: T) -> Self
Create a new instance with an initial value to compare to
sourcepub fn get_max(&self) -> Option<T>
pub fn get_max(&self) -> Option<T>
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.
sourcepub fn get_max_extreme(&self) -> T where
T: Bounded,
pub fn get_max_extreme(&self) -> T where
T: Bounded,
Return the maximal value found so far
This method falls back to the minimal value for type T
, if no other value exists.
Trait Implementations
sourceimpl<T> FromIterator<T> for Max<T> where
T: Ord,
impl<T> FromIterator<T> for Max<T> where
T: Ord,
sourcefn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
Creates a value from an iterator. Read more
sourceimpl<T: Ord> Ord for Max<T>
impl<T: Ord> Ord for Max<T>
sourceimpl<T: PartialOrd> PartialOrd<Max<T>> for Max<T>
impl<T: PartialOrd> PartialOrd<Max<T>> for Max<T>
sourcefn partial_cmp(&self, other: &Max<T>) -> Option<Ordering>
fn partial_cmp(&self, other: &Max<T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl<T: Copy> Copy for Max<T>
impl<T: Eq> Eq for Max<T>
impl<T> StructuralEq for Max<T>
impl<T> StructuralPartialEq for Max<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for Max<T> where
T: RefUnwindSafe,
impl<T> Send for Max<T> where
T: Send,
impl<T> Sync for Max<T> where
T: Sync,
impl<T> Unpin for Max<T> where
T: Unpin,
impl<T> UnwindSafe for Max<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more