TryPredecessor

Trait TryPredecessor 

Source
pub trait TryPredecessor: PartialOrd + Sized {
    // Required method
    fn try_predecessor(&self) -> Option<Self>;

    // Provided methods
    fn is_predecessor_of(&self, other: &Self) -> bool { ... }
    fn is_not_predecessor_of(&self, other: &Self) -> bool { ... }
}
Expand description

A partial order in which some elements have predecessors, i.e., unique greatest lesser values.

Every order can implement this trait, mathematically speaking it is quite boring. The actual computation of predecessors (when they exist) is the interesting part.

Required Methods§

Source

fn try_predecessor(&self) -> Option<Self>

If self has a predecessor, i.e., a unique greatest value which is strictly less than self, returns it. If there is no unique predecessor, returns None.

Provided Methods§

Source

fn is_predecessor_of(&self, other: &Self) -> bool

Returns true iff self is the predecessor of other.

Source

fn is_not_predecessor_of(&self, other: &Self) -> bool

Returns true iff self is not the predecessor of other.

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.

Implementations on Foreign Types§

Source§

impl TryPredecessor for i8

Source§

fn try_predecessor(&self) -> Option<Self>

Source§

impl TryPredecessor for i16

Source§

fn try_predecessor(&self) -> Option<Self>

Source§

impl TryPredecessor for i32

Source§

fn try_predecessor(&self) -> Option<Self>

Source§

impl TryPredecessor for i64

Source§

fn try_predecessor(&self) -> Option<Self>

Source§

impl TryPredecessor for i128

Source§

fn try_predecessor(&self) -> Option<Self>

Source§

impl TryPredecessor for isize

Source§

fn try_predecessor(&self) -> Option<Self>

Source§

impl TryPredecessor for u8

Source§

fn try_predecessor(&self) -> Option<Self>

Source§

impl TryPredecessor for u16

Source§

fn try_predecessor(&self) -> Option<Self>

Source§

impl TryPredecessor for u32

Source§

fn try_predecessor(&self) -> Option<Self>

Source§

impl TryPredecessor for u64

Source§

fn try_predecessor(&self) -> Option<Self>

Source§

impl TryPredecessor for u128

Source§

fn try_predecessor(&self) -> Option<Self>

Source§

impl TryPredecessor for usize

Source§

fn try_predecessor(&self) -> Option<Self>

Source§

impl<const N: usize, T> TryPredecessor for [T; N]

Source§

fn try_predecessor(&self) -> Option<Self>

Implementors§