Skip to main content

Parser

Trait Parser 

Source
pub trait Parser {
    // Required methods
    fn write(&mut self, chunk: &[u8]) -> Vec<Event>;
    fn flush(&mut self) -> Vec<Event>;
    fn reset(&mut self);
}
Expand description

An incremental, chunk-safe Markdown parser.

Feed bytes with write and drain the returned events; call flush at end of input to close any open blocks. The emitted event stream is independent of how the input is split across write calls (split-equivalence) — the single most important invariant of this library.

Required Methods§

Source

fn write(&mut self, chunk: &[u8]) -> Vec<Event>

Feed a chunk of input. Returns any events that became complete as a result. A chunk may end mid-line; the parser buffers the remainder until the next write/flush.

Source

fn flush(&mut self) -> Vec<Event>

Signal end of input: process any buffered partial line and emit closing events for every still-open block (ending with ExitBlock(Document)).

Source

fn reset(&mut self)

Clear all state so the parser can be reused for a new document.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§