pub trait Decrement:
Sized
+ One
+ Sub<Output = Self>
+ SubAssign
+ Copy {
// Provided methods
fn decrement(&mut self) { ... }
fn decrement_checked(&mut self) -> Result<(), ()>
where Self: OverflowBehavior + MinValue + PartialEq { ... }
fn can_decrement(&self) -> bool
where Self: OverflowBehavior + MinValue + PartialEq { ... }
fn predecessor(self) -> Self { ... }
fn predecessor_checked(&mut self) -> Result<Self, ()>
where Self: OverflowBehavior + MinValue + PartialEq { ... }
fn have_predecessor(self) -> bool
where Self: OverflowBehavior + MinValue + PartialEq { ... }
}Expand description
The -1 operation
Provided Methods§
Sourcefn decrement_checked(&mut self) -> Result<(), ()>
fn decrement_checked(&mut self) -> Result<(), ()>
The increment x-- operator
Sourcefn can_decrement(&self) -> bool
fn can_decrement(&self) -> bool
Do the current value have a predecessor.
True if not Self::MIN, except for wrapping type, they always have a predecessor because they wrap
Sourcefn predecessor(self) -> Self
fn predecessor(self) -> Self
Return the predecessor self - 1
Sourcefn predecessor_checked(&mut self) -> Result<Self, ()>
fn predecessor_checked(&mut self) -> Result<Self, ()>
Return the predecessor self - 1
Sourcefn have_predecessor(self) -> bool
fn have_predecessor(self) -> bool
Do the current value have a predecessor.
True if not Self::MIN, except for wrapping type, they always have a predecessor because they wrap
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.