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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.