INNER CODE UNIT · Rust
get
bgreenwell/doxx · src/widgets/mod.rs:26
pub fn get(&self, element_index: usize, width: u16) -> Option<&Vec<Line<'static>>> {
self.cache.get(&(element_index, width))
}
/// Store wrapped lines for an element
pub fn insert(&mut self, element_index: usize, width: u16, lines: Vec<Line<'static>>) {
self.cache.insert((element_index, width), lines);
}
/// Invalidate cache if terminal width changed
pub fn check_width(&mut self, width: u16) {
if width != self.last_width {
self.cache.clear();
self.last_width = width;
}
}
}