Struct maud::Utf8Writer
[−]
[src]
pub struct Utf8Writer<W: Write> { // some fields omitted }
Wraps a std::io::Write
in a std::fmt::Write
.
Most I/O libraries work with binary data ([u8]
), but Maud outputs
Unicode strings (str
). This adapter links them together by
encoding the output as UTF-8.
Example
use std::io; let mut writer = Utf8Writer::new(io::stdout()); let _ = html!(writer, p { "Hello, " $name "!" }); let result = writer.into_result(); result.unwrap();
Methods
impl<W: Write> Utf8Writer<W>
fn new(inner: W) -> Utf8Writer<W>
Creates a Utf8Writer
from a std::io::Write
.
fn into_inner(self) -> (W, Result<()>)
Extracts the inner writer, along with any errors encountered along the way.
fn into_result(self) -> Result<()>
Drops the inner writer, returning any errors encountered along the way.