Trait horrorshow::Template
[−]
[src]
pub trait Template: RenderOnce + Sized { fn into_string(self) -> Result<String, Error> { ... } fn write_to_string(self, string: &mut String) -> Result<(), Error> { ... } fn write_to_fmt(self, writer: &mut Write) -> Result<(), Error> { ... } fn write_to_io(self, writer: &mut Write) -> Result<(), Error> { ... } }
A template that can be rendered into something.
Don't let the single impl below fool you, these methods are available on all Render*
's
(through impls on references and boxes).
Provided Methods
fn into_string(self) -> Result<String, Error>
Render this into a new String.
fn write_to_string(self, string: &mut String) -> Result<(), Error>
Render this into an existing String.
Note: You could also use render_into_fmt but this is noticeably faster.
fn write_to_fmt(self, writer: &mut Write) -> Result<(), Error>
Render this into something that implements fmt::Write.
FnRenderer also implements Display but that's about twice as slow...
fn write_to_io(self, writer: &mut Write) -> Result<(), Error>
Render this into something that implements io::Write.
Note: If you're writing directly to a file/socket etc., you should seriously consider wrapping your writer in a BufWriter. Otherwise, you'll end up making quite a few unnecessary system calls.
Implementors
impl<T: RenderOnce + Sized> Template for T