blob: 20f13ffd54f94b1758edd058ef66142383e7d471 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#[derive(Debug)]
pub struct IdGen {
next: u64,
}
impl IdGen {
pub fn new(start: u64) -> Self {
IdGen { next: start }
}
pub fn gen(&mut self) -> u64 {
let res = self.next;
self.next += 1;
res
}
}
|