Trait core::iter::Step [] [src]

pub trait Step: PartialOrd + Sized {
    fn step(&self, by: &Self) -> Option<Self>;
    fn steps_between(start: &Self, end: &Self, by: &Self) -> Option<usize>;
}
Unstable (step_trait #27741)

: likely to be replaced by finer-grained traits

Objects that can be stepped over in both directions.

The steps_between function provides a way to efficiently compare two Step objects.

Required Methods

fn step(&self, by: &Self) -> Option<Self>

Unstable (step_trait #27741)

: likely to be replaced by finer-grained traits

Steps self if possible.

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

Unstable (step_trait #27741)

: likely to be replaced by finer-grained traits

Returns the number of steps between two step objects. The count is inclusive of start and exclusive of end.

Returns None if it is not possible to calculate steps_between without overflow.

Implementors