anchors 0.6.0

async incremental computations
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use std::num::NonZeroU64;

#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
pub struct Generation(NonZeroU64);
impl Generation {
    pub fn new() -> Generation {
        Generation(NonZeroU64::new(1).unwrap())
    }
    pub fn increment(&mut self) {
        let gen: u64 = u64::from(self.0) + 1;
        self.0 = NonZeroU64::new(gen).unwrap();
    }
}