pub trait TeraConnExt {
    fn assign(self, key: &str, value: impl Serialize) -> Self;
    fn render(self, template: &str) -> Self;
    fn tera(&self) -> &Tera;
    fn context_mut(&mut self) -> &mut Context;
    fn context(&self) -> &Context;
}
Expand description

Extends trillium::Conn with tera template-rendering functionality.

Required Methods

Adds a key-value pair to the assigns Context, where the key is a &str and the value is any Serialize type.

Uses the accumulated assigns context to render the template by registered name to the conn body and return the conn. Halts and sets a 200 status on successful render. Must be run downsequence of the TeraHandler, and will panic if the TeraHandler has not already been called.

Retrieves a reference to the Tera instance. Must be called downsequence of the TeraHandler, and will panic if the TeraHandler has not already been called.

retrieves a reference to the tera assigns context. must be run downsequence of the TeraHandler, and will panic if the TeraHandler has not already been called.

Retrieves a reference to the tera assigns context. Must be run downsequence of the TeraHandler, and will panic if the TeraHandler has not already been called.

Implementations on Foreign Types

Implementors