pub trait Render {
// Required method
fn render(&self) -> Node;
// Provided method
fn update_node(&self, parent: &Node, node: &Node) -> Node { ... }
}
Expand description
Trait for describing how something should be rendered into DOM nodes.
Required Methods§
Provided Methods§
Sourcefn update_node(&self, parent: &Node, node: &Node) -> Node
fn update_node(&self, parent: &Node, node: &Node) -> Node
Called when the node should be updated with new state.
The default implementation of this will replace the child node completely with the result of calling render
again.
Another implementation might be better suited to some specific types.
For example, text nodes can simply replace the inner text instead of recreating a new node.
Returns the new node. If the node is reused instead of replaced, the returned node is simply the node passed in.