git-next/crates/git/src/generation.rs

16 lines
383 B
Rust
Raw Normal View History

#[derive(Copy, Clone, Default, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub struct Generation(u32);
impl Generation {
pub fn new() -> Self {
Self::default()
}
pub fn inc(&mut self) {
self.0 += 1
}
}
impl std::fmt::Display for Generation {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0)
}
}