use super::{file::File, ino::Ino}; use std::collections::HashMap; #[derive(Debug)] pub struct Fcache { inner: HashMap, } impl Fcache { pub fn new() -> Self { Self { inner: HashMap::new(), } } pub fn insert(&mut self, ino: Ino, file: File) -> Option { self.inner.insert(ino, file) } pub fn get(&self, ino: Ino) -> Option<&File> { self.inner.get(&ino) } pub fn get_mut(&mut self, ino: Ino) -> Option<&mut File> { self.inner.get_mut(&ino) } pub fn remove(&mut self, ino: Ino) -> Option { self.inner.remove(&ino) } }