pub trait Render {
// Required method
fn render(&self, _w: &mut Vec<String>) -> ElementResult<()>;
// Provided methods
fn html(&self) -> String { ... }
fn render_tree(self) -> ElementResult<Html>
where Self: Sized { ... }
fn render_tree_into(
self,
parent: &mut Element,
renderables: &mut Renderables,
) -> ElementResult<BTreeMap<String, Element>>
where Self: Sized { ... }
fn render_node(
self,
_parent: &mut Element,
_map: &mut Hooks,
_renderables: &mut Renderables,
) -> ElementResult<()>
where Self: Sized { ... }
fn remove_event_listeners(&self) -> ElementResult<()> { ... }
}Expand description
Implemented by values that can be rendered both to an HTML string and to
live DOM nodes, optionally exposing @name hooks and retained renderables.
Required Methods§
Provided Methods§
Sourcefn html(&self) -> String
fn html(&self) -> String
Renders this value to an HTML string by concatenating its markup fragments.
Sourcefn render_tree(self) -> ElementResult<Html>where
Self: Sized,
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.
Sourcefn 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,
Renders this value’s DOM nodes into the existing parent element,
collecting retained renderables and returning the resulting map of
@name hook bindings.
Sourcefn render_node(
self,
_parent: &mut Element,
_map: &mut Hooks,
_renderables: &mut Renderables,
) -> ElementResult<()>where
Self: Sized,
fn render_node(
self,
_parent: &mut Element,
_map: &mut Hooks,
_renderables: &mut Renderables,
) -> ElementResult<()>where
Self: Sized,
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.
Sourcefn remove_event_listeners(&self) -> ElementResult<()>
fn remove_event_listeners(&self) -> ElementResult<()>
Releases any retained event-listener closures held by this value and its children. The default implementation does nothing.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".