1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//! # Sequential ID Generator
//!
//! This crate provides a simple sequential ID generator that can be used to generate unique sequential IDs.
//! The generator allows you to specify the step to increment the value by. To use the generator, you need to
//! ensure that only one instance of the generator is created. This can be achieved by using a singleton pattern
//! or by using a global variable.
//!
//! The crate provides a `Generator` trait that you can implement to create your own generator. The crate also
//! provides a `SimpleGenerator` that you can use out of the box.
//!
//! The crate is `no_std` compatible. To use the crate in a `no_std` environment, you need to disable the default
//! features and enable the `no_std` feature in your `Cargo.toml`.
//!
//! ```toml
//! [dependencies]
//! sequential-gen = { version = "0.1", default-features = false, features = ["no_std"] }
//! ```
//!
//! ## Usage
//!
//! ```rust
//! # extern crate lazy_static;
//!
//! # use lazy_static::lazy_static;
//! use sequential_gen::prelude::*;
//!
//! lazy_static! {
//! static ref GENERATOR: SimpleGenerator<u128> = SimpleGenerator::new(1u128);
//! }
//!
//! fn main() {
//! let id = GENERATOR.generate();
//! // Use your ID
//! }
//! ```
//!
//! ## Features
//! The following features are available:
//! - `default`: Enables the standard library.
//! - `no_std`: Disables the standard library.
//! - `uuid`: Enables support for generating UUIDs. This feature is not available in a `no_std` environment.
compile_error!;