pub struct MarkdownRenderCache { /* private fields */ }Expand description
Bounded LRU cache for render_markdown output.
Stores the most recent rendered markdown slices keyed by a content
fingerprint and target width. Keeping several entries avoids cache thrash
when one frame renders transcript text alongside summary, review, or footer
markdown blocks. Interior mutability via RefCell allows cache updates
through shared references so the cache can be threaded through immutable
render contexts without requiring &mut at every call site.
Cached values are stored as Arc<[Line<'static>]> so cache hits can reuse
the rendered slice without cloning every line. Callers only clone Line
values when they need to append the cached content into a larger output
buffer.
Implementations§
Source§impl MarkdownRenderCache
impl MarkdownRenderCache
Sourcepub fn render(&self, text: &str, width: usize) -> Arc<[Line<'static>]> ⓘ
pub fn render(&self, text: &str, width: usize) -> Arc<[Line<'static>]> ⓘ
Returns cached rendered lines when the text hash, width, and cache version match; otherwise renders fresh and updates the cache.
Sourcepub fn bump_version(&self)
pub fn bump_version(&self)
Bumps the cache version and drops all rendered entries.
Callers use this when non-content render settings change; the active theme is already part of each cache key.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for MarkdownRenderCache
impl !RefUnwindSafe for MarkdownRenderCache
impl Send for MarkdownRenderCache
impl !Sync for MarkdownRenderCache
impl Unpin for MarkdownRenderCache
impl UnsafeUnpin for MarkdownRenderCache
impl UnwindSafe for MarkdownRenderCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more