Skip to main content

DocumentReader

Trait DocumentReader 

Source
pub trait DocumentReader: Send + Sync {
    // Required methods
    fn id(&self) -> FormatId;
    fn read<'a>(&self, src: &'a Source, ctx: &ReadContext) -> Result<Events<'a>>;

    // Provided method
    fn capabilities(&self) -> ReaderCaps { ... }
}
Expand description

Turns bytes into the internal model. This is what the original design called a “Renderer”: it produces the document, it does not paint it.

Required Methods§

Source

fn id(&self) -> FormatId

Source

fn read<'a>(&self, src: &'a Source, ctx: &ReadContext) -> Result<Events<'a>>

Reads src and returns the stream. The 'a lifetime ties the events to the source, which is what lets Cow::Borrowed borrow from the mmap without copying.

Provided Methods§

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§