pub struct Html {
pub roots: Vec<Element>,
pub hooks: Hooks,
pub renderables: Renderables,
}Expand description
The result of rendering an HTML template: the live DOM root elements, the
map of @name-tagged hook elements, and the retained Rust renderables that
keep elements and callbacks alive for the lifetime of this structure.
Fields§
§roots: Vec<Element>The top-level DOM elements produced by the template.
hooks: HooksMap of @name-tagged elements available for external binding.
renderables: RenderablesRetained renderables that keep DOM elements and Rust state alive.
Implementations§
Source§impl Html
impl Html
Sourcepub fn new(
roots: Vec<Element>,
hooks: Hooks,
renderables: Renderables,
) -> ElementResult<Html>
pub fn new( roots: Vec<Element>, hooks: Hooks, renderables: Renderables, ) -> ElementResult<Html>
Constructs an Html from its rendered root elements, hooks map and
retained renderables.
Sourcepub fn roots(&self) -> &Vec<Element>
pub fn roots(&self) -> &Vec<Element>
Returns the top-level DOM elements produced by the template.
Sourcepub fn hooks(&self) -> &Hooks
pub fn hooks(&self) -> &Hooks
Returns the map of @name-tagged elements available for external binding.
Sourcepub fn inject_into(&self, element: &Element) -> ElementResult<()>
pub fn inject_into(&self, element: &Element) -> ElementResult<()>
Appends each root element into the given parent DOM element.
Sourcepub fn remove_event_listeners(&self) -> ElementResult<()>
pub fn remove_event_listeners(&self) -> ElementResult<()>
Removes all event listeners from every retained renderable, releasing their closures.
Trait Implementations§
Source§impl Render for Html
impl Render for Html
Source§fn render_node(
self,
parent: &mut WebElement,
map: &mut Hooks,
renderables: &mut Renderables,
) -> ElementResult<()>
fn render_node( self, parent: &mut WebElement, map: &mut Hooks, renderables: &mut Renderables, ) -> ElementResult<()>
_parent, recording any
@name hooks into _map and pushing retained renderables onto
_renderables. The default implementation does nothing.Source§fn render(&self, _w: &mut Vec<String>) -> ElementResult<()>
fn render(&self, _w: &mut Vec<String>) -> ElementResult<()>
_w.Source§fn remove_event_listeners(&self) -> ElementResult<()>
fn remove_event_listeners(&self) -> ElementResult<()>
Source§fn html(&self) -> String
fn html(&self) -> String
Source§fn render_tree(self) -> ElementResult<Html>where
Self: Sized,
fn render_tree(self) -> ElementResult<Html>where
Self: Sized,
Html
holding the resulting root elements, hooks and retained renderables.Source§fn render_tree_into(
self,
parent: &mut Element,
renderables: &mut Renderables,
) -> ElementResult<BTreeMap<String, Element>>where
Self: Sized,
fn render_tree_into(
self,
parent: &mut Element,
renderables: &mut Renderables,
) -> ElementResult<BTreeMap<String, Element>>where
Self: Sized,
parent element,
collecting retained renderables and returning the resulting map of
@name hook bindings.