Write

Trait Write 

Source
pub trait Write: Write {
    // Provided methods
    fn write_text(&mut self, text: &str) -> Result<(), Error> { ... }
    fn write_hole_value(
        &mut self,
        label: &str,
        value: Value<'_>,
    ) -> Result<(), Error> { ... }
    fn write_hole_fmt(
        &mut self,
        label: &str,
        value: Value<'_>,
        formatter: Formatter,
    ) -> Result<(), Error> { ... }
    fn write_hole_label(&mut self, label: &str) -> Result<(), Error> { ... }
}
Expand description

A template-aware writer used by Render::write to format a template.

Provided Methods§

Source

fn write_text(&mut self, text: &str) -> Result<(), Error>

Write a text fragment.

This method is called for any Part::text in the template.

Source

fn write_hole_value( &mut self, label: &str, value: Value<'_>, ) -> Result<(), Error>

Write a hole with a matching value.

This method is called for any Part::hole in the template without special formatting requirements where a matching property exists.

Source

fn write_hole_fmt( &mut self, label: &str, value: Value<'_>, formatter: Formatter, ) -> Result<(), Error>

Write a hole with a matching value and formatter.

This method is called for any Part::hole in the template with special formatting requirements where a matching property exists.

Source

fn write_hole_label(&mut self, label: &str) -> Result<(), Error>

Write a hole without a matching value.

This method is called for any Part::hole in the template where a matching property doesn’t exist.

Implementations on Foreign Types§

Source§

impl Write for String

Available on crate feature alloc only.
Source§

impl<'a> Write for Formatter<'a>

Source§

fn write_hole_value(&mut self, _: &str, value: Value<'_>) -> Result<(), Error>

Source§

fn write_hole_fmt( &mut self, _: &str, value: Value<'_>, formatter: Formatter, ) -> Result<(), Error>

Source§

impl<'a, W> Write for &'a mut W
where W: Write + ?Sized,

Source§

fn write_text(&mut self, text: &str) -> Result<(), Error>

Source§

fn write_hole_value( &mut self, label: &str, value: Value<'_>, ) -> Result<(), Error>

Source§

fn write_hole_fmt( &mut self, label: &str, value: Value<'_>, formatter: Formatter, ) -> Result<(), Error>

Source§

fn write_hole_label(&mut self, label: &str) -> Result<(), Error>

Implementors§