Skip to main content

PageContext

Struct PageContext 

Source
pub struct PageContext<'a> {
    pub site_title: &'a str,
    pub nav: &'a SiteNavigation,
    pub seo_meta: &'a str,
    pub feed_links: &'a str,
    pub lang: &'a str,
    pub template: Option<&'a ShellTemplate>,
    pub site_header: &'a str,
    pub site_footer: &'a str,
}
Expand description

Everything about the site that wrapping one page in its shell needs.

A struct rather than seven positional arguments because the shell grew slots — a template, a language, per-page assets — and a call site that reads (page, title, false, &nav, &seo, &feeds) is one whose next argument goes in the wrong place.

Fields§

§site_title: &'a str

The site’s name, for <title> and the {{site_title}} slot.

§nav: &'a SiteNavigation

This page’s nav tree and breadcrumb trail.

§seo_meta: &'a str

Pre-rendered SEO <meta> tags, or empty.

§feed_links: &'a str

Pre-rendered feed <link> tags, or empty.

§lang: &'a str

BCP 47 language tag for <html lang="…">.

§template: Option<&'a ShellTemplate>

The caller’s shell, or None for the built-in one. Ignored by a page whose layout is PageLayout::Bare.

§site_header: &'a str

The site’s header document, already rendered for this page — the site_header slot. Empty when the site declares none.

§site_footer: &'a str

The site’s footer document, on the same terms — the site_footer slot.

Auto Trait Implementations§

§

impl<'a> Freeze for PageContext<'a>

§

impl<'a> RefUnwindSafe for PageContext<'a>

§

impl<'a> Send for PageContext<'a>

§

impl<'a> Sync for PageContext<'a>

§

impl<'a> Unpin for PageContext<'a>

§

impl<'a> UnsafeUnpin for PageContext<'a>

§

impl<'a> UnwindSafe for PageContext<'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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.