Skip to main content

LayoutContext

Struct LayoutContext 

Source
pub struct LayoutContext<'a> {
    pub title: &'a str,
    pub content: &'a str,
    pub head: &'a str,
    pub body_class: &'a str,
    pub view_json: &'a str,
    pub data_json: &'a str,
    pub scripts: &'a str,
}
Expand description

Context passed to layout render functions.

Contains all data a layout needs to produce a complete HTML page: the rendered component HTML, page metadata, and serialized view/data for potential frontend hydration.

Fields§

§title: &'a str

Page title for the <title> element.

§content: &'a str

Rendered component HTML fragment (output of render_to_html).

§head: &'a str

Additional <head> content (Tailwind CDN link, custom styles).

§body_class: &'a str

CSS classes for the <body> element.

§view_json: &'a str

Serialized view JSON for the data-view attribute.

§data_json: &'a str

Serialized data JSON for the data-props attribute.

§scripts: &'a str

JS assets and init scripts for plugins, injected before closing body tag.

Auto Trait Implementations§

§

impl<'a> Freeze for LayoutContext<'a>

§

impl<'a> RefUnwindSafe for LayoutContext<'a>

§

impl<'a> Send for LayoutContext<'a>

§

impl<'a> Sync for LayoutContext<'a>

§

impl<'a> Unpin for LayoutContext<'a>

§

impl<'a> UnsafeUnpin for LayoutContext<'a>

§

impl<'a> UnwindSafe for LayoutContext<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.