pub trait Increase:
Sized
+ One
+ Add<Output = Self>
+ AddAssign
+ Copy {
// Provided methods
fn increase(&mut self) { ... }
fn increase_checked(&mut self) -> Result<(), ()>
where Self: OverflowBehavior + MaxValue + PartialEq { ... }
fn can_increase(&self) -> bool
where Self: OverflowBehavior + MaxValue + PartialEq { ... }
fn successor(self) -> Self { ... }
fn successor_checked(&mut self) -> Result<Self, ()>
where Self: OverflowBehavior + MaxValue + PartialEq { ... }
fn have_successor(self) -> bool
where Self: OverflowBehavior + MaxValue + PartialEq { ... }
}Expand description
The +1 operation
Provided Methods§
Sourcefn increase_checked(&mut self) -> Result<(), ()>
fn increase_checked(&mut self) -> Result<(), ()>
The increment x++ operator
Sourcefn can_increase(&self) -> bool
fn can_increase(&self) -> bool
Do the current value have a successor.
True if not Self::MAX, except for wrapping type, they always have a successor because they wrap
Sourcefn successor_checked(&mut self) -> Result<Self, ()>
fn successor_checked(&mut self) -> Result<Self, ()>
Return the successor self + 1
Sourcefn have_successor(self) -> bool
fn have_successor(self) -> bool
Do the current value have a successor.
True if not Self::MAX, except for wrapping type, they always have a successor 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.