[−][src]Struct misc_utils::Max
Helper type to ensure to calculate a maximal value
Methods
impl<T> Max<T> where
T: Copy + Ord,
[src]
T: Copy + Ord,
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]
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.
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(&self) -> 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]
fn partial_cmp(&self, other: &Max<T>) -> Option<Ordering>
[src]
fn lt(&self, other: &Max<T>) -> bool
[src]
fn le(&self, other: &Max<T>) -> bool
[src]
fn gt(&self, other: &Max<T>) -> bool
[src]
fn ge(&self, other: &Max<T>) -> bool
[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 cmp(&self, other: &Max<T>) -> Ordering
[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]
T: Copy + Ord,
impl<T: Hash> Hash for Max<T>
[src]
fn hash<__HT: Hasher>(&self, state: &mut __HT)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<T> FromIterator<T> for Max<T> where
T: Ord,
[src]
T: Ord,
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
[src]
impl<T: Debug> Debug for Max<T>
[src]
impl<T> Display for Max<T> where
T: Display,
[src]
T: Display,
impl<T> FromStr for Max<T> where
T: Copy + FromStr + Ord,
[src]
T: Copy + FromStr + Ord,
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,