Trait alemat::Writer

source ·
pub trait Writer {
    type Buffer;
    type Error: Error;

Show 27 methods // Required methods fn buffer<T>(&self) -> &T where Self::Buffer: Borrow<T>; fn finish(&mut self) -> Self::Buffer; fn into_inner(self) -> Self::Buffer; // Provided methods fn write_action(&mut self, _action: &Action) -> Result<(), Self::Error> { ... } fn write_annotation( &mut self, _annotation: &Annotation ) -> Result<(), Self::Error> { ... } fn write_error(&mut self, _error: &Error) -> Result<(), Self::Error> { ... } fn write_frac(&mut self, _frac: &Frac) -> Result<(), Self::Error> { ... } fn write_ident(&mut self, _ident: &Ident) -> Result<(), Self::Error> { ... } fn write_multiscripts( &mut self, _multiscripts: &Multiscripts ) -> Result<(), Self::Error> { ... } fn write_prescripts( &mut self, _prescripts: &Prescripts ) -> Result<(), Self::Error> { ... } fn write_num(&mut self, _num: &Num) -> Result<(), Self::Error> { ... } fn write_operator( &mut self, _operator: &Operator ) -> Result<(), Self::Error> { ... } fn write_padded(&mut self, _padded: &Padded) -> Result<(), Self::Error> { ... } fn write_phantom(&mut self, _phantom: &Phantom) -> Result<(), Self::Error> { ... } fn write_radical(&mut self, _radical: &Radical) -> Result<(), Self::Error> { ... } fn write_row(&mut self, _row: &Row) -> Result<(), Self::Error> { ... } fn write_semantics( &mut self, _semantics: &Semantics ) -> Result<(), Self::Error> { ... } fn write_space(&mut self, _space: &Space) -> Result<(), Self::Error> { ... } fn write_str_literal( &mut self, _str_literal: &StrLiteral ) -> Result<(), Self::Error> { ... } fn write_style(&mut self, _style: &Style) -> Result<(), Self::Error> { ... } fn write_subsup(&mut self, _sub_sup: &SubSup) -> Result<(), Self::Error> { ... } fn write_table(&mut self, _table: &Table) -> Result<(), Self::Error> { ... } fn write_text(&mut self, _text: &Text) -> Result<(), Self::Error> { ... } fn write_underover( &mut self, _under_over: &UnderOver ) -> Result<(), Self::Error> { ... } fn write_attr(&mut self, _attr: &Attribute) -> Result<(), Self::Error> { ... } fn write_element(&mut self, tag: &Element) -> Result<(), Self::Error> { ... } fn write_mathml(&mut self, mathml: &MathMl) -> Result<(), Self::Error> { ... }
}
Expand description

Trait for writing MathML elements. Each method in this trait has a default implementation that does nothing.

In contrast with Renderer trait, implementors of this trait are meant to write the rendered representation into a buffer instead of returning the rendered output from each function. This enables buffered rendering, where instead of allocating many Strings (for example), one String is allocated and written into.

Each method in this trait has a default implementation that corresponds to a no-op. This makes it possible to potentially introduce new elements without breaking existing renderers. This also means that any new elements introduced will be omitted in the final render, as long as the corresponding methods are not implemented.

Required Associated Types§

source

type Buffer

The type of the buffer that this writer writes into.

source

type Error: Error

The Error type of the writer that will be returned by write_* methods in cases where writing can fail. Use Infallible for writers that cannot fail.

Required Methods§

source

fn buffer<T>(&self) -> &T
where Self::Buffer: Borrow<T>,

Return a reference to the buffer.

source

fn finish(&mut self) -> Self::Buffer

Produce a rendered representation of the MathMl content written into the Writer.

source

fn into_inner(self) -> Self::Buffer

Consume the Writer and return the inner buffer.

Provided Methods§

source

fn write_action(&mut self, _action: &Action) -> Result<(), Self::Error>

Write an Action element.

source

fn write_annotation( &mut self, _annotation: &Annotation ) -> Result<(), Self::Error>

Write an Annotation element.

source

fn write_error(&mut self, _error: &Error) -> Result<(), Self::Error>

Write an Error element.

source

fn write_frac(&mut self, _frac: &Frac) -> Result<(), Self::Error>

Write a Frac element.

source

fn write_ident(&mut self, _ident: &Ident) -> Result<(), Self::Error>

Write an Ident element.

source

fn write_multiscripts( &mut self, _multiscripts: &Multiscripts ) -> Result<(), Self::Error>

Write a Multiscripts element.

source

fn write_prescripts( &mut self, _prescripts: &Prescripts ) -> Result<(), Self::Error>

Write a Prescripts element.

source

fn write_num(&mut self, _num: &Num) -> Result<(), Self::Error>

Write a Num element.

source

fn write_operator(&mut self, _operator: &Operator) -> Result<(), Self::Error>

Write an Operator element.

source

fn write_padded(&mut self, _padded: &Padded) -> Result<(), Self::Error>

Write a Padded element.

source

fn write_phantom(&mut self, _phantom: &Phantom) -> Result<(), Self::Error>

Write a Phantom element.

source

fn write_radical(&mut self, _radical: &Radical) -> Result<(), Self::Error>

Write a Radical element.

source

fn write_row(&mut self, _row: &Row) -> Result<(), Self::Error>

Write a Row element.

source

fn write_semantics(&mut self, _semantics: &Semantics) -> Result<(), Self::Error>

Write a Semantics element.

source

fn write_space(&mut self, _space: &Space) -> Result<(), Self::Error>

Write a Space element.

source

fn write_str_literal( &mut self, _str_literal: &StrLiteral ) -> Result<(), Self::Error>

Write a StrLiteral element.

source

fn write_style(&mut self, _style: &Style) -> Result<(), Self::Error>

Write a Style element.

source

fn write_subsup(&mut self, _sub_sup: &SubSup) -> Result<(), Self::Error>

Write a SubSup element.

source

fn write_table(&mut self, _table: &Table) -> Result<(), Self::Error>

Write a Table element.

source

fn write_text(&mut self, _text: &Text) -> Result<(), Self::Error>

Write a Text element.

source

fn write_underover( &mut self, _under_over: &UnderOver ) -> Result<(), Self::Error>

Write an UnderOver element.

source

fn write_attr(&mut self, _attr: &Attribute) -> Result<(), Self::Error>

Write an Attribute element.

source

fn write_element(&mut self, tag: &Element) -> Result<(), Self::Error>

Write an Element into the Self::Buffer.

source

fn write_mathml(&mut self, mathml: &MathMl) -> Result<(), Self::Error>

Write a MathMl element.

Object Safety§

This trait is not object safe.

Implementors§