kvarn_async::prelude::compact_str::core::iter

Trait Step

source
pub trait Step:
    Sized
    + Clone
    + PartialOrd {
    // Required methods
    fn steps_between(start: &Self, end: &Self) -> Option<usize>;
    fn forward_checked(start: Self, count: usize) -> Option<Self>;
    fn backward_checked(start: Self, count: usize) -> Option<Self>;

    // Provided methods
    fn forward(start: Self, count: usize) -> Self { ... }
    unsafe fn forward_unchecked(start: Self, count: usize) -> Self { ... }
    fn backward(start: Self, count: usize) -> Self { ... }
    unsafe fn backward_unchecked(start: Self, count: usize) -> Self { ... }
}
🔬This is a nightly-only experimental API. (step_trait)
Expand description

Objects that have a notion of successor and predecessor operations.

The successor operation moves towards values that compare greater. The predecessor operation moves towards values that compare lesser.

Required Methods§

source

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

🔬This is a nightly-only experimental API. (step_trait)

Returns the number of successor steps required to get from start to end.

Returns <