use nutype::nutype;
#[nutype(derive(Debug, Clone, Copy, PartialEq, Eq))]
pub(super) struct SpawnGeneration(u64);
impl SpawnGeneration {
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!(SpawnGeneration::initial().next(), SpawnGeneration::new(1));
}
}