sequential is a tiny library that provides with Sequence a sequential number generator that
- produces monotonously increasing integer numbers, starting from a configurable starting point and with a configurable increment
- can be fast-forwarded to skip numbers, but cannot be wound back
- stops producing values when the limit of the chosen type T is reached
- optionally (with feature serde) implements serde's
SerializeandDeserializeso that its state can be persisted - works with all unsigned integers, from
u8tou128, and withusize. - strictly uses
checked_*arithmetics to avoid panic caused by number overflow.
Usage
Add sequential to the dependencies section in your project's Cargo.toml
[]
= "0.3"
Example
let mut sequence = new;
assert_eq!;
assert_eq!;
Features
serde (optional)
Adds the serialization and deserialization capability.
Dependencies
The library has no external dependency except the optional one to serde.