Trait maple_core::render::Render[][src]

pub trait Render {
    fn render(&self) -> Node;

    fn update_node(&self, parent: &Node, node: &Node) -> Node { ... }
}

Trait for describing how something should be rendered into DOM nodes.

Required methods

fn render(&self) -> Node[src]

Called during the initial render when creating the DOM nodes. Should return a Node.

Loading content...

Provided methods

fn update_node(&self, parent: &Node, node: &Node) -> Node[src]

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.

Loading content...

Implementors

impl Render for TemplateList[src]

impl Render for TemplateResult[src]

impl<T: Display + ?Sized> Render for T[src]

Loading content...