Trait core::iter::StepUnstable [-]  [+] [src]

pub trait Step: Ord {
    fn step(&mut self);
    fn step_back(&mut self);
    fn steps_between(start: &Self, end: &Self) -> Option<usize>;
}

The Step trait identifies objects which can be stepped over in both directions. The steps_between function provides a way to compare two Step objects (it could be provided using step() and Ord, but the implementation would be so inefficient as to be useless).

Required Methods

fn step(&mut self)

Change self to the next object.

fn step_back(&mut self)

Change self to the previous object.

fn steps_between(start: &Self, end: &Self) -> Option<usize>

The steps_between two step objects. start should always be less than end, so the result should never be negative. Return None if it is not possible to calculate steps_between without overflow.

Implementors