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§
Sourcefn try_successor(&self) -> Option<Self>
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§
Sourcefn is_successor_of(&self, other: &Self) -> bool
fn is_successor_of(&self, other: &Self) -> bool
Returns true iff self is the successor of other.
Sourcefn is_not_successor_of(&self, other: &Self) -> bool
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.