Trait step::Step
[−]
[src]
pub trait Step: Sized { fn next(&self) -> Option<Self>; fn next_by(&self, by: &Self) -> Option<Self>; fn prev(&self) -> Option<Self>; fn prev_by(&self, by: &Self) -> Option<Self>; fn steps_to(&self, value: &Self) -> Self; }
Types that can be incremented or decremented by a unit value or a given value.
Required Methods
fn next(&self) -> Option<Self>
Return the next sequential value for the type
fn next_by(&self, by: &Self) -> Option<Self>
Return the value a given amount after the value
fn prev(&self) -> Option<Self>
Return the previous sequential value for the type
fn prev_by(&self, by: &Self) -> Option<Self>
Return the value a given amount before the value
fn steps_to(&self, value: &Self) -> Self
Return the steps to another value
The return value will be the number of steps between the two values (i.e. it will always be a positive number).