libs: implement Generation Into<u32>

This commit is contained in:
John Spray
2023-09-04 14:58:03 +01:00
parent 145685201a
commit 3e09cabb6a

View File

@@ -89,6 +89,14 @@ impl Generation {
Self::Broken => panic!("Attempted to use a broken generation"),
}
}
pub fn into(self) -> Option<u32> {
if let Self::Valid(v) = self {
Some(v)
} else {
None
}
}
}
impl Serialize for Generation {