Struct horrorshow::TemplateBuffer[][src]

pub struct TemplateBuffer<'a> { /* fields omitted */ }
Expand description

A template buffer. This is the type that gets passed to closures inside templates.

Example:

    html! {
        |tmpl /*: &mut TemplateBuffer */| tmpl << "Some String";
    };

Implementations

Record an error. If a template calls this function, rendering will be short-circuited and the error will be returned to the user.

FEATURE:

  • With “alloc” but without “std”, accepts anything that can be converted to a string (anything implementing ToString).
  • Without “std” or “alloc”, accepts a static &str. Multiple calls will record the first error.

Write a raw string to the template output.

Escape and write the formatted arguments to the template output.

Example:

write!(tmpl, "{} + {}", 0, 1);

Escape and write a string to the template output.

Returns an escaping Write adapter.

Returns a non-escaping Write adapter.

Trait Implementations

Render the component into the template.

Note: If writing to the template fails, this method will neither panic nor return errors. Instead, no more data will be written to the template and horrorshow abort template rendering (return an error) when it re-gains control.

The resulting type after applying the << operator.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.