TrySuccessor

Trait TrySuccessor 

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

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

A partial order in which some elements have successors, i.e., unique least greater values.

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

Required Methods§

Source

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

If self has a successor, i.e., a unique least value which is strictly greater than self, returns it. If there is no unique successor, returns None.

Provided Methods§

Source

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

Returns true iff self is the successor of other.

Source

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

Returns true iff self is not the successor 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 TrySuccessor for i8

Source§

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

Source§

impl TrySuccessor for i16

Source§

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

Source§

impl TrySuccessor for i32

Source§

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

Source§

impl TrySuccessor for i64

Source§

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

Source§

impl TrySuccessor for i128

Source§

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

Source§

impl TrySuccessor for isize

Source§

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

Source§

impl TrySuccessor for u8

Source§

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

Source§

impl TrySuccessor for u16

Source§

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

Source§

impl TrySuccessor for u32

Source§

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

Source§

impl TrySuccessor for u64

Source§

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

Source§

impl TrySuccessor for u128

Source§

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

Source§

impl TrySuccessor for usize

Source§

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

Source§

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

Source§

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

Implementors§