MCPcopy Create free account
hub / github.com/GCWing/BitFun / render_cached

Method render_cached

src/apps/cli/src/ui/markdown.rs:40–48  ·  view source on GitHub ↗

Render markdown with caching. Returns cached result if content+width match.

(&mut self, content: &str, width: usize)

Source from the content-addressed store, hash-verified

38
39 /// Render markdown with caching. Returns cached result if content+width match.
40 pub fn render_cached(&mut self, content: &str, width: usize) -> Vec<Line<'static>> {
41 let key = Self::cache_key(content, width);
42 if let Some(cached) = self.cache.get(&key) {
43 return cached.clone();
44 }
45 let lines = self.render(content, width);
46 self.cache.insert(key, lines.clone());
47 lines
48 }
49
50 /// Clear the markdown render cache (e.g. on session switch)
51 pub fn clear_cache(&mut self) {

Callers 1

render_messageMethod · 0.80

Calls 4

renderMethod · 0.65
getMethod · 0.45
cloneMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected