diff --git a/libs/utils/src/generation.rs b/libs/utils/src/generation.rs index 8f70eb2ed2..88d50905c6 100644 --- a/libs/utils/src/generation.rs +++ b/libs/utils/src/generation.rs @@ -90,6 +90,14 @@ impl Generation { } } + pub fn next(&self) -> Generation { + match self { + Self::Valid(n) => Self::Valid(*n + 1), + Self::None => Self::Valid(1), + Self::Broken => panic!("Attempted to use a broken generation"), + } + } + pub fn into(self) -> Option { if let Self::Valid(v) = self { Some(v)