Enum MinMaxResult
pub enum MinMaxResult<T>
MinMaxResult is an enum returned by minmax.
See .minmax() for more detail.
Variants
-
NoElements Empty iterator
-
OneElement(T) Iterator with one element, so the minimum and maximum are the same
-
MinMax(T, T) More than one element in the iterator, the first element is not larger than the second
Implementations
impl<T: Clone> MinMaxResult<T>
fn into_option(self) -> Option<(T, T)>into_optioncreates anOptionof type(T, T). The returnedOptionhas variantNoneif and only if theMinMaxResulthas variantNoElements. OtherwiseSome((x, y))is returned wherex <= y. If theMinMaxResulthas variantOneElement(x), performing this operation will make one clone ofx.Examples
use ; let r: = NoElements; assert_eq!; let r = OneElement; assert_eq!; let r = MinMax; assert_eq!;
Trait Implementations
impl<T: Clone> Clone for MinMaxResult<T>
fn clone(&self) -> MinMaxResult<T>
impl<T: Copy> Copy for MinMaxResult<T>
impl<T: Debug> Debug for MinMaxResult<T>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<T: Eq> Eq for MinMaxResult<T>
impl<T: PartialEq> PartialEq for MinMaxResult<T>
fn eq(&self, other: &MinMaxResult<T>) -> bool
impl<T: PartialEq> StructuralPartialEq for MinMaxResult<T>
Auto Trait Implementations
impl<T> Freeze for MinMaxResult<T>
where
T: Freeze + Freeze + Freeze,
impl<T> RefUnwindSafe for MinMaxResult<T>
where
T: RefUnwindSafe + RefUnwindSafe + RefUnwindSafe,
impl<T> Send for MinMaxResult<T>
where
T: Send + Send + Send,
impl<T> Sync for MinMaxResult<T>
where
T: Sync + Sync + Sync,
impl<T> Unpin for MinMaxResult<T>
where
T: Unpin + Unpin + Unpin,
impl<T> UnsafeUnpin for MinMaxResult<T>
where
T: UnsafeUnpin + UnsafeUnpin + UnsafeUnpin,
impl<T> UnwindSafe for MinMaxResult<T>
where
T: UnwindSafe + UnwindSafe + UnwindSafe,
Blanket Implementations
impl<T> Any for MinMaxResult<T>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for MinMaxResult<T>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for MinMaxResult<T>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for MinMaxResult<T>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for MinMaxResult<T>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> IntoEither for MinMaxResult<T>
impl<T> ToOwned for MinMaxResult<T>
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for MinMaxResult<T>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for MinMaxResult<T>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for MinMaxResult<T>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>