pub struct Builder<'b> { /* private fields */ }
Expand description
Create a new HTML builder.
Implementations§
Source§impl<'b> Builder<'b>
impl<'b> Builder<'b>
Sourcepub fn raw_body(self, body: &'b str) -> Self
pub fn raw_body(self, body: &'b str) -> Self
Add a body to the document. The body must include <body></body>
tags.
Sourcepub fn description(self, desc: &str) -> Self
pub fn description(self, desc: &str) -> Self
Add a <meta name="description">
tag.
Sourcepub fn theme_color(self, color: &str) -> Self
pub fn theme_color(self, color: &str) -> Self
Add a <meta name="theme-color">
tag.
Sourcepub fn script(self, src: &str) -> Self
pub fn script(self, src: &str) -> Self
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.
Sourcepub fn module(self, src: &str) -> Self
pub fn module(self, src: &str) -> Self
Add a <script type="module">
tag that fetches a remote resource.
Sourcepub fn inline_module(self, src: &str) -> Self
pub fn inline_module(self, src: &str) -> Self
Add a <script type="module">
tag that contains an inline resource.
Sourcepub fn lazy_script(self, src: &str) -> Self
pub fn lazy_script(self, src: &str) -> Self
Add a <link rel="prefetch">
tag. This is ideal for loading scripts in
the background after the main application has loaded.
Sourcepub fn blocking_script(self, src: &str) -> Self
pub fn blocking_script(self, src: &str) -> Self
Add a <script>
tag. This is ideal for loading scripts that should be
loaded before any rendering can start.
Sourcepub fn inline_script(self, src: &str) -> Self
pub fn inline_script(self, src: &str) -> Self
Add a <script></script>
tag. This is ideal for loading custom scripts
that are essential for loading.
Sourcepub fn style(self, src: &str) -> Self
pub fn style(self, src: &str) -> Self
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
Sourcepub fn inline_style(self, src: &str) -> Self
pub fn inline_style(self, src: &str) -> Self
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.
Sourcepub fn blocking_style(self, src: &str) -> Self
pub fn blocking_style(self, src: &str) -> Self
Add a blocking <link rel="stylesheet">
tag. This is ideal for externally
loading scripts that should be loaded before any rendering can be
initialized.
Trait Implementations§
Auto Trait Implementations§
impl<'b> Freeze for Builder<'b>
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§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)