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

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

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>

Steps self if possible.

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

Returns the number of steps between two step objects.

start should always be less than end, so the result should never be negative.

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

Implementors