INNER CODE UNIT · Rust

new

bgreenwell/doxx · src/widgets/mod.rs:18

    pub fn new() -> Self {
        Self {
            cache: HashMap::new(),
            last_width: 0,
        }
    }

    /// Get cached lines for an element, if available
    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

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…