pub trait StepLite {
    fn add_one(&self) -> Self;
fn sub_one(&self) -> Self; }
Expand description

Minimal version of unstable Step trait from the Rust standard library.

This is needed for RangeInclusiveMap because ranges stored as its keys interact with each other when the start of one is adjacent the end of another. I.e. we need a concept of successor values rather than just equality, and that is what Step will eventually provide once it is stabilized.

NOTE: This will likely be deprecated and then eventually removed once the standard library’s Step trait is stabilised, as most crates will then likely implement Step for their types where appropriate.

See this issue for details about that stabilization process.

Required methods

Returns the successor of self.

If this would overflow the range of values supported by Self, this function is allowed to panic, wrap, or saturate. The suggested behavior is to panic when debug assertions are enabled, and to wrap or saturate otherwise.

Returns the predecessor of self.

If this would overflow the range of values supported by Self, this function is allowed to panic, wrap, or saturate. The suggested behavior is to panic when debug assertions are enabled, and to wrap or saturate otherwise.

Implementations on Foreign Types

Implementors