blob: 03785c02d52107518b2a16d5230ded5cac9d166a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
use super::{file::File, ino::Ino};
use std::collections::HashMap;
#[derive(Debug)]
pub struct Fcache {
inner: HashMap<Ino, File>,
}
impl Fcache {
pub fn new() -> Self {
Self {
inner: HashMap::new(),
}
}
pub fn insert(&mut self, ino: Ino, file: File) -> Option<File> {
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<File> {
self.inner.remove(&ino)
}
}
|