mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-19 06:00:38 +00:00
libs: add Generation::next
This commit is contained in:
@@ -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<u32> {
|
||||
if let Self::Valid(v) = self {
|
||||
Some(v)
|
||||
|
||||
Reference in New Issue
Block a user