Skip to main content

Html

Struct Html 

Source
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: Hooks

Map of @name-tagged elements available for external binding.

§renderables: Renderables

Retained renderables that keep DOM elements and Rust state alive.

Implementations§

Source§

impl Html

Source

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.

Source

pub fn roots(&self) -> &Vec<Element>

Returns the top-level DOM elements produced by the template.

Source

pub fn hooks(&self) -> &Hooks

Returns the map of @name-tagged elements available for external binding.

Source

pub fn inject_into(&self, element: &Element) -> ElementResult<()>

Appends each root element into the given parent DOM element.

Source

pub fn remove_event_listeners(&self) -> ElementResult<()>

Removes all event listeners from every retained renderable, releasing their closures.

Trait Implementations§

Source§

impl Clone for Html

Source§

fn clone(&self) -> Html

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Render for Html

Source§

fn render_node( self, parent: &mut WebElement, map: &mut Hooks, renderables: &mut Renderables, ) -> ElementResult<()>

Builds the live DOM nodes for this value under _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<()>

Renders this value as HTML markup, appending fragments to _w.
Source§

fn remove_event_listeners(&self) -> ElementResult<()>

Releases any retained event-listener closures held by this value and its children. The default implementation does nothing.
Source§

fn html(&self) -> String

Renders this value to an HTML string by concatenating its markup fragments.
Source§

fn render_tree(self) -> ElementResult<Html>
where Self: Sized,

Renders this value into a detached container and returns an 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,

Renders this value’s DOM nodes into the existing parent element, collecting retained renderables and returning the resulting map of @name hook bindings.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Html

§

impl !Send for Html

§

impl !Sync for Html

§

impl !UnwindSafe for Html

§

impl Freeze for Html

§

impl Unpin for Html

§

impl UnsafeUnpin for Html

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more