Trait std::iter::StepUnstable
[-]
[+]
[src]
pub trait Step: Ord { fn step(&mut self); fn step_back(&mut self); fn steps_between(a: &Self, b: &Self) -> Option<uint>; }
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(a: &Self, b: &Self) -> Option<uint>
The steps_between two step objects. a should always be less than b, so the result should never be negative. Return None if it is not possible to calculate steps_between without overflow.