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>
[src]
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.
Trait Implementations
impl<W: Write> Write for Utf8Writer<W>
[src]
fn write_str(&mut self, s: &str) -> Result
Writes a slice of bytes into this writer, returning whether the write succeeded. Read more
fn write_fmt(&mut self, args: Arguments) -> Result
Glue for usage of the write!
macro with implementors of this trait. Read more
fn write_char(&mut self, c: char) -> Result<(), Error>
1.1.0
Writes a char
into this writer, returning whether the write succeeded. Read more