pub struct MarkdownCache {
pub blocks: Vec<Block>,
pub heights: Vec<f32>,
pub cum_y: Vec<f32>,
pub total_height: f32,
pub last_scroll_y: f32,
/* private fields */
}Expand description
Cached pre-parsed blocks, height estimates, and the source hash.
Fields§
§blocks: Vec<Block>§heights: Vec<f32>Estimated pixel height for each top-level block (same len as blocks).
cum_y: Vec<f32>Cumulative Y offsets: cum_y[i] = sum of heights[0..i].
total_height: f32Total estimated height of all blocks.
last_scroll_y: f32Last rendered scroll-y offset (set by show_scrollable).
Implementations§
Source§impl MarkdownCache
impl MarkdownCache
pub fn ensure_parsed(&mut self, source: &str)
pub fn ensure_heights( &mut self, body_size: f32, wrap_width: f32, style: &MarkdownStyle, )
Sourcepub fn heading_y(&self, ordinal: usize) -> Option<f32>
pub fn heading_y(&self, ordinal: usize) -> Option<f32>
Return the Y offset for the ordinalth non-empty heading block
(0-based). Empty headings (no visible text) are skipped so the
ordinal aligns with nav_outline::extract_headings which also
excludes them.
Uses the pre-cached heading_block_indices for O(1) lookup.
Trait Implementations§
Source§impl Default for MarkdownCache
impl Default for MarkdownCache
Source§fn default() -> MarkdownCache
fn default() -> MarkdownCache
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MarkdownCache
impl RefUnwindSafe for MarkdownCache
impl !Send for MarkdownCache
impl !Sync for MarkdownCache
impl Unpin for MarkdownCache
impl UnsafeUnpin for MarkdownCache
impl UnwindSafe for MarkdownCache
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
Mutably borrows from an owned value. Read more