Skip to main content

MarkupBackend

Trait MarkupBackend 

Source
pub trait MarkupBackend: Send + Sync {
    // Required methods
    fn id(&self) -> BackendId;
    fn decode(
        &self,
        input: &str,
        opts: &MarkupDecodeOptions,
    ) -> Result<(MarkupDoc, MarkupFidelity), MarkupError>;
    fn encode(
        &self,
        doc: &MarkupDoc,
        opts: &MarkupEncodeOptions,
    ) -> Result<(String, MarkupFidelity), MarkupError>;
}
Expand description

A concrete markup reader/writer behind a runtime codec id.

Required Methods§

Source

fn id(&self) -> BackendId

Stable backend id, such as markdown, typst, asciidoc, or latex.

Source

fn decode( &self, input: &str, opts: &MarkupDecodeOptions, ) -> Result<(MarkupDoc, MarkupFidelity), MarkupError>

Decode backend source text into the shared markup document IR.

Source

fn encode( &self, doc: &MarkupDoc, opts: &MarkupEncodeOptions, ) -> Result<(String, MarkupFidelity), MarkupError>

Encode the shared markup document IR into backend source text.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§