pub struct TemplateContext { /* private fields */ }Expand description
Per-request template context shared between middleware and handlers.
TemplateContextLayer populates an instance with
request-scoped values (locale, current_url, is_htmx, csrf_token,
flash_messages) and inserts it into request extensions before the handler runs.
Handlers access the merged context through the Renderer
extractor. Values supplied by a handler override middleware-set values for the
same key (handler context wins on conflicts).
Implementations§
Trait Implementations§
Source§impl Clone for TemplateContext
impl Clone for TemplateContext
Source§fn clone(&self) -> TemplateContext
fn clone(&self) -> TemplateContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TemplateContext
impl Debug for TemplateContext
Source§impl Default for TemplateContext
impl Default for TemplateContext
Source§fn default() -> TemplateContext
fn default() -> TemplateContext
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TemplateContext
impl !RefUnwindSafe for TemplateContext
impl Send for TemplateContext
impl Sync for TemplateContext
impl Unpin for TemplateContext
impl UnsafeUnpin for TemplateContext
impl !UnwindSafe for TemplateContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more