[][src]Struct html_index::Builder

pub struct Builder<'b> { /* fields omitted */ }

Create a new HTML builder.

Implementations

impl<'b> Builder<'b>[src]

pub fn new() -> Self[src]

Create a new instance from an HTML body, including <body></body> tags.

pub fn raw_body(self, body: &'b str) -> Self[src]

Add a body to the document. The body must include <body></body> tags.

pub fn lang(self, lang: &'b str) -> Self[src]

Set the document language.

pub fn description(self, desc: &str) -> Self[src]

Add a <meta name="description"> tag.

pub fn theme_color(self, color: &str) -> Self[src]

Add a <meta name="theme-color"> tag.

pub fn title(self, title: &str) -> Self[src]

Add a <title> tag.

pub fn script(self, src: &str) -> Self[src]

Add a <script defer> tag. This is ideal for loading scripts that are important for the main application, but shouldn't interfere with the initial rendering.

pub fn module(self, src: &str) -> Self[src]

Add a <script type="module"> tag that fetches a remote resource.

pub fn inline_module(self, src: &str) -> Self[src]

Add a <script type="module"> tag that contains an inline resource.

pub fn lazy_script(self, src: &str) -> Self[src]

Add a <link rel="prefetch"> tag. This is ideal for loading scripts in the background after the main application has loaded.

pub fn blocking_script(self, src: &str) -> Self[src]

Add a <script> tag. This is ideal for loading scripts that should be loaded before any rendering can start.

pub fn inline_script(self, src: &str) -> Self[src]

Add a <script></script> tag. This is ideal for loading custom scripts that are essential for loading.

pub fn style(self, src: &str) -> Self[src]

Add a non-blocking <link as="style"> tag. This is ideal for including styles that aren't essential for an initial render pass.

Generally this should be combined with .inline_style() to optimize a render pipeline.

onerror exists because of a bug in firefox. See https://github.com/filamentgroup/loadCSS/issues/246 for more details

pub fn inline_style(self, src: &str) -> Self[src]

Add an inline <style> tag. This is ideal for including styles that should be available for an initial render pass.

Generally this should be combined with .style() to optimize a render pipeline.

pub fn blocking_style(self, src: &str) -> Self[src]

Add a blocking <link rel="stylesheet"> tag. This is ideal for externally loading scripts that should be loaded before any rendering can be initialized.

pub fn favicon(self, src: &str) -> Self[src]

Add a favicon.

pub fn manifest(self, src: &str) -> Self[src]

Add a manifest.json link.

pub fn font(self, src: &str) -> Self[src]

Add a <link as="font"> tag.

pub fn build(self) -> String[src]

Create an HTML document.

Trait Implementations

impl<'b> Clone for Builder<'b>[src]

impl<'b> Debug for Builder<'b>[src]

impl<'b> Default for Builder<'b>[src]

impl<'_> Into<Response> for Builder<'_>[src]

Auto Trait Implementations

impl<'b> RefUnwindSafe for Builder<'b>

impl<'b> Send for Builder<'b>

impl<'b> Sync for Builder<'b>

impl<'b> Unpin for Builder<'b>

impl<'b> UnwindSafe for Builder<'b>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Sealed<T> for T where
    T: ?Sized

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.