TryOrd

Trait TryOrd 

Source
pub trait TryOrd: TryEq + TryPartialOrd<Self> {
    // Required method
    fn try_cmp(&self, other: &Self) -> Result<Ordering, Self::Error>;

    // Provided methods
    fn try_max(self, other: Self) -> Result<Self, Self::Error>
       where Self: Sized { ... }
    fn try_min(self, other: Self) -> Result<Self, Self::Error>
       where Self: Sized { ... }
    fn try_clamp(self, min: Self, max: Self) -> Result<Self, Self::Error>
       where Self: Sized { ... }
}
Expand description

The try trait for Ord.

Required Methods§

Source

fn try_cmp(&self, other: &Self) -> Result<Ordering, Self::Error>

The fallible equivalent of Ord::cmp.

Provided Methods§

Source

fn try_max(self, other: Self) -> Result<Self, Self::Error>
where Self: Sized,

The fallible equivalent of Ord::max.

Source

fn try_min(self, other: Self) -> Result<Self, Self::Error>
where Self: Sized,

The fallible equivalent of Ord::min.

Source

fn try_clamp(self, min: Self, max: Self) -> Result<Self, Self::Error>
where Self: Sized,

The fallible equivalent of Ord::clamp.

§Panics

Panics if min > max

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T: Ord> TryOrd for T