struct IrWalker<'c, 'src> {
cursor: SentinelCursor<'c, 'src>,
top: Vec<IrBlock>,
open: Vec<OpenContainer>,
}Expand description
Tree builder that consumes comrak nodes plus a sentinel cursor and
emits IrBlocks into a stack-balanced container hierarchy.
The state mirrors crate::post_process’s SpliceState for the
HTML side: same cursor, same balanced-container model, same
orphan-close drain at end-of-document. They differ only in the
emit target (string buffer vs. tree of Vec<IrBlock>).
Lifetimes:
'cis the lifetime of the registry slice the walker borrows (typically a localVec<NodeRef<'src>>materialised at the call site).'srcis the arena/source lifetime that every borrowed [AozoraNode] payload references.
Fields§
§cursor: SentinelCursor<'c, 'src>§top: Vec<IrBlock>Document-level blocks gathered so far. When a container is
open, new blocks go onto its top-of-stack children instead.
open: Vec<OpenContainer>Stack of currently-open paired containers. Each frame owns the blocks gathered between its open and (eventual) close marker.
Implementations§
Source§impl<'c, 'src> IrWalker<'c, 'src>
impl<'c, 'src> IrWalker<'c, 'src>
fn new(nodes: &'c [NodeRef<'src>]) -> Self
Sourcefn with_cursor_idx(nodes: &'c [NodeRef<'src>], idx: usize) -> Self
fn with_cursor_idx(nodes: &'c [NodeRef<'src>], idx: usize) -> Self
Construct a walker that resumes from a given cursor index in
nodes. Used by StreamingIrBuilder to thread cursor state
across per-block walks.
Sourcefn finish(self) -> Vec<IrBlock>
fn finish(self) -> Vec<IrBlock>
Consume the walker, draining any unclosed containers (mirror of the HTML splicer’s end-of-document orphan-close pass).
fn walk_root<'a>(&mut self, root: &'a AstNode<'a>)
fn walk_top<'a>(&mut self, node: &'a AstNode<'a>)
Sourcefn classify_paragraph<'a>(
&self,
node: &'a AstNode<'a>,
) -> Option<ParagraphAction<'src>>
fn classify_paragraph<'a>( &self, node: &'a AstNode<'a>, ) -> Option<ParagraphAction<'src>>
Run a single descent over node’s text descendants, returning
the most specific paragraph action (sole block sentinel or
heading hint promotion) supported by the registry lookahead.
fn dispatch_paragraph( &mut self, action: ParagraphAction<'src>, source_line: u32, )
fn handle_block_sentinel(&mut self, kind: BlockSentinelKind, source_line: u32)
fn handle_heading_hint( &mut self, hint: &'src HeadingHint<'src>, sentinels_to_consume: usize, source_line: u32, )
fn walk_block<'a>( &mut self, node: &'a AstNode<'a>, top_level: bool, ) -> Option<IrBlock>
fn walk_table<'a>(&mut self, node: &'a AstNode<'a>, meta: TableMeta) -> IrBlock
fn collect_blocks<'a>(&mut self, node: &'a AstNode<'a>) -> Vec<IrBlock>
fn collect_list_items<'a>(&mut self, node: &'a AstNode<'a>) -> Vec<IrListItem>
fn collect_table_row<'a>(&mut self, row: &'a AstNode<'a>) -> IrTableRow
fn collect_inlines<'a>(&mut self, node: &'a AstNode<'a>) -> Vec<IrInline>
fn emit_inline<'a>(&mut self, node: &'a AstNode<'a>, out: &mut Vec<IrInline>)
fn project_text_with_sentinels( &mut self, text: &str, range: Option<Range>, out: &mut Vec<IrInline>, )
Auto Trait Implementations§
impl<'c, 'src> Freeze for IrWalker<'c, 'src>
impl<'c, 'src> RefUnwindSafe for IrWalker<'c, 'src>
impl<'c, 'src> Send for IrWalker<'c, 'src>
impl<'c, 'src> Sync for IrWalker<'c, 'src>
impl<'c, 'src> Unpin for IrWalker<'c, 'src>
impl<'c, 'src> UnsafeUnpin for IrWalker<'c, 'src>
impl<'c, 'src> UnwindSafe for IrWalker<'c, 'src>
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
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg] or
a color-specific method, such as [OwoColorize::green], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg] or
a color-specific method, such as [OwoColorize::on_yellow], Read more