pub struct Max<T> { /* private fields */ }
Expand description
Helper type to ensure to calculate a maximal value
Implementations§
Source§impl<T> Max<T>
impl<T> Max<T>
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) -> Twhere
T: Bounded,
pub fn get_max_extreme(&self) -> Twhere
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§
Source§impl<T> FromIterator<T> for Max<T>where
T: Ord,
impl<T> FromIterator<T> for Max<T>where
T: Ord,
Source§fn 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
Source§impl<T: Ord> Ord for Max<T>
impl<T: Ord> Ord for Max<T>
Source§impl<T: PartialOrd> PartialOrd for Max<T>
impl<T: PartialOrd> PartialOrd for Max<T>
impl<T: Copy> Copy for Max<T>
impl<T: Eq> Eq for Max<T>
impl<T> StructuralPartialEq for Max<T>
Auto Trait Implementations§
impl<T> Freeze for Max<T>where
T: Freeze,
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§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more