From ced8d50092ef1fb525beed57c90ebcb4a2d2e56e Mon Sep 17 00:00:00 2001 From: Chris Wong <lambda.fairy@gmail.com> Date: Mon, 19 Jan 2015 16:38:38 +1300 Subject: [PATCH] Document Markup a bit more --- maud/src/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/maud/src/lib.rs b/maud/src/lib.rs index d046b7b..d948a77 100644 --- a/maud/src/lib.rs +++ b/maud/src/lib.rs @@ -162,6 +162,9 @@ pub fn escape(s: &str) -> String { } /// A block of HTML markup, as returned by the `html!` macro. +/// +/// Use `.render()` to convert it to a `String`, or `.render_to()` to +/// write it directly to a handle. pub struct Markup<'a> { callback: &'a (Fn(&mut fmt::Writer) -> fmt::Result + 'a), } @@ -175,6 +178,9 @@ impl<'a> Markup<'a> { } /// Render the markup to a `std::io::Writer`. + /// + /// If you're writing to, say, a file or a socket, this may be more + /// efficient than calling `.render()`. pub fn render_to(&self, w: &mut Writer) -> IoResult<()> { struct WriterWrapper<'a, 'b: 'a> { inner: &'a mut (Writer + 'b),