pub struct HtmlShell {
    pub shell: String,
    pub head_before_boundary: Vec<String>,
    pub scripts_before_boundary: Vec<String>,
    pub head_after_boundary: Vec<String>,
    pub scripts_after_boundary: Vec<String>,
    pub content: String,
    pub before_content: Vec<String>,
    pub after_content: Vec<String>,
    /* private fields */
}
Expand description

The shell used to interpolate the Perseus app into, including associated scripts and content defined by the user, components of the Perseus core, and plugins.

Fields

shell: String

The actual shell content, on whcih interpolations will be performed.

head_before_boundary: Vec<String>

Additional contents of the head before the interpolation boundary.

scripts_before_boundary: Vec<String>

Scripts to be inserted before the interpolation boundary.

head_after_boundary: Vec<String>

Additional contents of the head after the interpolation boundary. These will be wiped out after a page transition.

scripts_after_boundary: Vec<String>

Scripts to be interpolated after the interpolation bounary. These will be wiped out after a page transition.

content: String

Content to be interpolated into the body of the shell.

before_content: Vec<String>

Code to be inserted into the shell before the Perseus contents of the page. This is designed to be modified by plugins.

after_content: Vec<String>

Code to be inserted into the shell after the Perseus contents of the page. This is designed to be modified by plugins.

Implementations

Initializes the HTML shell by interpolating necessary scripts into it and adding the render configuration.

Interpolates page data and global state into the shell.

Interpolates a fallback for locale redirection pages such that, even if JavaScript is disabled, the user will still be redirected to the default locale. From there, Perseus’ inbuilt progressive enhancement can occur, but without this a user directed to an unlocalized page with JS disabled would see a blank screen, which is terrible UX. Note that this also includes a fallback for if JS is enabled but Wasm is disabled. Note that the redirect URL is expected to be generated with a path prefix inbuilt.

This also adds a __perseus_initial_state <div> in case it’s needed (for Wasm redirections).

Further, this will preload the Wasm binary, making redirection snappier (but initial load slower), a tradeoff that generally improves UX.

Interpolates page error data into the shell in the event of a failure.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Called during the initial render when creating the DOM nodes. Should return a Vec of GenericNodes. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.