pub struct MdRenderCache { /* private fields */ }Expand description
Increment-only fast-path cache for the streaming assistant render site.
Holds the last (text, width) pair plus the lines render_markdown
produced for it. render_markdown_cached is a thin wrapper that
returns the cached lines when the new call’s (text, width) exactly
equals the cached one — the streaming typewriter advances a few bytes
each frame, but most frames the visible message and viewport are
unchanged, so the equality fast-path is the common case. Anything else
(different text, different width, first call) falls through to the
full renderer and refreshes the cache.
Implementations§
Source§impl MdRenderCache
impl MdRenderCache
Sourcepub fn debug_hits(&self) -> usize
pub fn debug_hits(&self) -> usize
Number of times the fast path returned the cached lines without
invoking render_markdown. Test-only accessor — kept on the type
so the test module can read it without a pub(crate) escape.
Trait Implementations§
Source§impl Debug for MdRenderCache
impl Debug for MdRenderCache
Source§impl Default for MdRenderCache
impl Default for MdRenderCache
Source§fn default() -> MdRenderCache
fn default() -> MdRenderCache
Auto Trait Implementations§
impl Freeze for MdRenderCache
impl RefUnwindSafe for MdRenderCache
impl Send for MdRenderCache
impl Sync for MdRenderCache
impl Unpin for MdRenderCache
impl UnsafeUnpin for MdRenderCache
impl UnwindSafe for MdRenderCache
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> 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