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 String
s (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§
sourcetype Error: Error
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§
sourcefn into_inner(self) -> Self::Buffer
fn into_inner(self) -> Self::Buffer
Consume the Writer
and return the inner buffer.
Provided Methods§
sourcefn write_action(&mut self, _action: &Action) -> Result<(), Self::Error>
fn write_action(&mut self, _action: &Action) -> Result<(), Self::Error>
Write an Action
element.
sourcefn write_annotation(
&mut self,
_annotation: &Annotation
) -> Result<(), Self::Error>
fn write_annotation( &mut self, _annotation: &Annotation ) -> Result<(), Self::Error>
Write an Annotation
element.
sourcefn write_multiscripts(
&mut self,
_multiscripts: &Multiscripts
) -> Result<(), Self::Error>
fn write_multiscripts( &mut self, _multiscripts: &Multiscripts ) -> Result<(), Self::Error>
Write a Multiscripts
element.
sourcefn write_prescripts(
&mut self,
_prescripts: &Prescripts
) -> Result<(), Self::Error>
fn write_prescripts( &mut self, _prescripts: &Prescripts ) -> Result<(), Self::Error>
Write a Prescripts
element.
sourcefn write_operator(&mut self, _operator: &Operator) -> Result<(), Self::Error>
fn write_operator(&mut self, _operator: &Operator) -> Result<(), Self::Error>
Write an Operator
element.
sourcefn write_padded(&mut self, _padded: &Padded) -> Result<(), Self::Error>
fn write_padded(&mut self, _padded: &Padded) -> Result<(), Self::Error>
Write a Padded
element.
sourcefn write_phantom(&mut self, _phantom: &Phantom) -> Result<(), Self::Error>
fn write_phantom(&mut self, _phantom: &Phantom) -> Result<(), Self::Error>
Write a Phantom
element.
sourcefn write_radical(&mut self, _radical: &Radical) -> Result<(), Self::Error>
fn write_radical(&mut self, _radical: &Radical) -> Result<(), Self::Error>
Write a Radical
element.
sourcefn write_semantics(&mut self, _semantics: &Semantics) -> Result<(), Self::Error>
fn write_semantics(&mut self, _semantics: &Semantics) -> Result<(), Self::Error>
Write a Semantics
element.
sourcefn write_str_literal(
&mut self,
_str_literal: &StrLiteral
) -> Result<(), Self::Error>
fn write_str_literal( &mut self, _str_literal: &StrLiteral ) -> Result<(), Self::Error>
Write a StrLiteral
element.
sourcefn write_subsup(&mut self, _sub_sup: &SubSup) -> Result<(), Self::Error>
fn write_subsup(&mut self, _sub_sup: &SubSup) -> Result<(), Self::Error>
Write a SubSup
element.
sourcefn write_underover(
&mut self,
_under_over: &UnderOver
) -> Result<(), Self::Error>
fn write_underover( &mut self, _under_over: &UnderOver ) -> Result<(), Self::Error>
Write an UnderOver
element.
sourcefn write_attr(&mut self, _attr: &Attribute) -> Result<(), Self::Error>
fn write_attr(&mut self, _attr: &Attribute) -> Result<(), Self::Error>
Write an Attribute
element.