Trait rangemap::StepFns[][src]

pub trait StepFns<T> {
    fn add_one(start: &T) -> T;
fn sub_one(start: &T) -> T; }

Successor and predecessor functions defined for T, but as free functions rather than methods on T itself.

This is useful as a workaround for Rust's "orphan rules", which prevent you from implementing StepLite for T if T is a foreign type.

NOTE: This will likely be deprecated and then eventually removed once the standard library's Step trait is stabilised, as most crates will then likely implement Step for their types where appropriate.

See this issue for details about that stabilization process.

There is also a blanket implementation of StepFns for all types implementing StepLite. Consumers of this crate should prefer to implement StepLite for their own types, and only fall back to StepFns when dealing with foreign types.

Required methods

fn add_one(start: &T) -> T[src]

Returns the successor of value start.

fn sub_one(start: &T) -> T[src]

Returns the predecessor of value start.

Loading content...

Implementors

impl<T> StepFns<T> for T where
    T: StepLite
[src]

Loading content...