step
step
is a crate that provides the trait Step
, which allows for unit
steps and arbitrary steps on numeric types.
Documentation can be found on docs.rs.
Using step
Add the crate to the dependencies section of Cargo.toml:
[]
= { = "https://github.com/ryanq/step" }
Then import the crate and type in your source:
extern crate step;
use Step;
Then you can use the functions for incrementing and decrementing numbers or implement it on your own types:
let number = 42;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;