use nutype::nutype;
#[nutype(derive(Debug, Clone, Copy, PartialEq, Eq))]
pub(super) struct CompletionGeneration(u64);
impl CompletionGeneration {
pub(super) fn initial() -> Self {
Self::new(0)
}
pub(super) fn next(self) -> Self {
Self::new(self.into_inner().wrapping_add(1))
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn next_advances_the_generation() {
assert_eq!(
CompletionGeneration::initial().next(),
CompletionGeneration::new(1)
);
}
}