Trait trillium_tera::TeraConnExt
source · pub trait TeraConnExt {
// Required methods
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§
sourcefn render(self, template: &str) -> Self
fn render(self, template: &str) -> Self
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.
sourcefn tera(&self) -> &Tera
fn tera(&self) -> &Tera
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.
sourcefn context_mut(&mut self) -> &mut Context
fn context_mut(&mut self) -> &mut Context
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.
sourcefn context(&self) -> &Context
fn context(&self) -> &Context
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.