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§
Sourcefn try_predecessor(&self) -> Option<Self>
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§
Sourcefn is_predecessor_of(&self, other: &Self) -> bool
fn is_predecessor_of(&self, other: &Self) -> bool
Returns true iff self is the predecessor of other.
Sourcefn is_not_predecessor_of(&self, other: &Self) -> bool
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.