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
#![crate_name = "tlid"]
use core::{
clone::Clone,
fmt::Debug,
ops::{Add, AddAssign, Sub},
};
mod allocator;
mod behavior;
mod pool;
pub use allocator::AllocError;
pub use behavior::{Behavior, Checked, CheckedError, UnChecked, Wrapping};
pub use pool::Pool;
#[cfg(feature = "num-traits")]
extern crate num_traits;
#[cfg(feature = "serde")] extern crate serde;
pub trait IdAble:
Ord + Copy + Add<Output = Self> + Sub<Output = Self> + AddAssign + Default + Debug + From<u8>
{
fn inc(&mut self);
fn inc_by(&mut self, other: Self);
}
impl<X: Ord + Clone + Copy + Add<Output = X> + Sub<Output = Self> + AddAssign + Default + Debug + From<u8>> IdAble
for X
{
fn inc(&mut self) { *self += X::from(1); }
fn inc_by(&mut self, other: Self) { *self += other; }
}