pub trait Incrementable: PartialOrd + Sized {
// Required methods
fn next(&self) -> Option<Self>;
fn max() -> Option<Self>;
}
Expand description
A type which can attempt to return the smallest value which is still bigger than the current value.
It is used for index and generation type parameters to find the next index or the next generation respectively.
§Examples
An implementation of Incrementable
has been made for all integer types.
use gen_value::Incrementable;
let value: u32 = 1;
assert_eq!(value.next(), Some(2));
assert_eq!(u32::MAX.next(), None);
Required Methods§
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.