use std::fmt::Display; const ROOT_INO: u64 = 1; #[derive(Clone, Debug, Eq, PartialEq, Hash, Copy)] pub struct Ino(u64); impl Ino { pub fn new() -> Self { Self(ROOT_INO) } pub fn next(&mut self) -> &Self { self.0 += 1; self } pub fn prev(&mut self) { self.0 -= 1; } } impl From for u64 { fn from(ino: Ino) -> Self { ino.0 } } impl From for Ino { fn from(ino: u64) -> Self { Self(ino) } } impl From for Ino { fn from(ino: u32) -> Self { Self(u64::from(ino)) } } impl Display for Ino { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { self.0.fmt(f) } } impl Default for Ino { fn default() -> Self { Self::new() } }