[−][src]Struct misc_utils::Min
Helper type to ensure to calculate a minimal value
Implementations
impl<T> Min<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_min(&self) -> Option<T>
[src]
Return the minimal 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_min_extreme(&self) -> T where
T: Bounded,
[src]
T: Bounded,
Return the minimal value found so far
This method falls back to the maximal 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 lower value
If value
is less than self
, then self is replaced with value
.
This method can be called with type T
or type Min<T>
.
Trait Implementations
impl<T: Clone> Clone for Min<T>
[src]
impl<T: Copy> Copy for Min<T>
[src]
impl<T: Debug> Debug for Min<T>
[src]
impl<T> Default for Min<T>
[src]
impl<T> Display for Min<T> where
T: Display,
[src]
T: Display,
impl<T: Eq> Eq for Min<T>
[src]
impl<T> From<T> for Min<T> where
T: Copy + Ord,
[src]
T: Copy + Ord,
impl<T> FromIterator<T> for Min<T> where
T: Ord,
[src]
T: Ord,
pub fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
[src]
impl<T> FromStr for Min<T> where
T: Copy + FromStr + Ord,
[src]
T: Copy + FromStr + Ord,
type Err = T::Err
The associated error which can be returned from parsing.
pub fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
impl<T: Hash> Hash for Min<T>
[src]
pub fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T: Ord> Ord for Min<T>
[src]
pub fn cmp(&self, other: &Min<T>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<T: PartialEq> PartialEq<Min<T>> for Min<T>
[src]
impl<T: PartialOrd> PartialOrd<Min<T>> for Min<T>
[src]
pub fn partial_cmp(&self, other: &Min<T>) -> Option<Ordering>
[src]
pub fn lt(&self, other: &Min<T>) -> bool
[src]
pub fn le(&self, other: &Min<T>) -> bool
[src]
pub fn gt(&self, other: &Min<T>) -> bool
[src]
pub fn ge(&self, other: &Min<T>) -> bool
[src]
impl<T> StructuralEq for Min<T>
[src]
impl<T> StructuralPartialEq for Min<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Min<T> where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
impl<T> Send for Min<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for Min<T> where
T: Sync,
[src]
T: Sync,
impl<T> Unpin for Min<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> UnwindSafe for Min<T> where
T: UnwindSafe,
[src]
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[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]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,