[−][src]Trait yew::virtual_dom::VDiff
This trait provides features to update a tree by other tree comparsion.
Associated Types
Loading content...Required methods
fn detach(&mut self, parent: &Node) -> Option<Node>
Remove itself from parent and return the next sibling.
fn apply(
&mut self,
parent: &Node,
precursor: Option<&Node>,
ancestor: Option<VNode<Self::Component>>,
scope: &Scope<Self::Component>
) -> Option<Node>
&mut self,
parent: &Node,
precursor: Option<&Node>,
ancestor: Option<VNode<Self::Component>>,
scope: &Scope<Self::Component>
) -> Option<Node>
Scoped diff apply to other tree.
Virtual rendering for the node. It uses parent node and existing children (virtual and DOM) to check the difference and apply patches to the actual DOM represenatation.
Parameters:
parent
: the parent node in the DOM.precursor
: the "previous node" in a list of nodes, used to efficiently find where to put the node.ancestor
: the node that this node will be replacing in the DOM. This method will always remove theancestor
from theparent
.env
: theEnv
.
Internal Behavior Notice:
Note that these modify the DOM by modifying the reference that already exists
on the ancestor
. If self.reference
exists (which it shouldn't) this method
will panic.
The exception to this is obviously VRef
which simply uses the inner Node
directly
(always removes the Node
that exists).
Implementors
impl<COMP> VDiff for VComp<COMP> where
COMP: Component + 'static,
[src]
COMP: Component + 'static,
type Component = COMP
fn detach(&mut self, parent: &Node) -> Option<Node>
[src]
Remove VComp from parent.
fn apply(
&mut self,
parent: &Node,
precursor: Option<&Node>,
ancestor: Option<VNode<Self::Component>>,
env: &Scope<Self::Component>
) -> Option<Node>
[src]
&mut self,
parent: &Node,
precursor: Option<&Node>,
ancestor: Option<VNode<Self::Component>>,
env: &Scope<Self::Component>
) -> Option<Node>
Renders independent component over DOM Element
.
It also compares this with an ancestor VComp
and inherits sender of it.
impl<COMP: Component> VDiff for VNode<COMP>
[src]
type Component = COMP
fn detach(&mut self, parent: &Node) -> Option<Node>
[src]
Remove VNode from parent.
fn apply(
&mut self,
parent: &Node,
precursor: Option<&Node>,
ancestor: Option<VNode<Self::Component>>,
env: &Scope<Self::Component>
) -> Option<Node>
[src]
&mut self,
parent: &Node,
precursor: Option<&Node>,
ancestor: Option<VNode<Self::Component>>,
env: &Scope<Self::Component>
) -> Option<Node>
impl<COMP: Component> VDiff for VList<COMP>
[src]
type Component = COMP
fn detach(&mut self, parent: &Node) -> Option<Node>
[src]
fn apply(
&mut self,
parent: &Node,
precursor: Option<&Node>,
ancestor: Option<VNode<Self::Component>>,
env: &Scope<Self::Component>
) -> Option<Node>
[src]
&mut self,
parent: &Node,
precursor: Option<&Node>,
ancestor: Option<VNode<Self::Component>>,
env: &Scope<Self::Component>
) -> Option<Node>
impl<COMP: Component> VDiff for VTag<COMP>
[src]
type Component = COMP
fn detach(&mut self, parent: &Node) -> Option<Node>
[src]
Remove VTag from parent.
fn apply(
&mut self,
parent: &Node,
precursor: Option<&Node>,
ancestor: Option<VNode<Self::Component>>,
env: &Scope<Self::Component>
) -> Option<Node>
[src]
&mut self,
parent: &Node,
precursor: Option<&Node>,
ancestor: Option<VNode<Self::Component>>,
env: &Scope<Self::Component>
) -> Option<Node>
Renders virtual tag over DOM Element
, but it also compares this with an ancestor VTag
to compute what to patch in the actual DOM nodes.
impl<COMP: Component> VDiff for VText<COMP>
[src]
type Component = COMP
fn detach(&mut self, parent: &Node) -> Option<Node>
[src]
Remove VTag from parent.
fn apply(
&mut self,
parent: &Node,
_: Option<&Node>,
opposite: Option<VNode<Self::Component>>,
_: &Scope<Self::Component>
) -> Option<Node>
[src]
&mut self,
parent: &Node,
_: Option<&Node>,
opposite: Option<VNode<Self::Component>>,
_: &Scope<Self::Component>
) -> Option<Node>
Renders virtual node over existent TextNode
, but
only if value of text had changed.
Parameter precursor
is necesssary for VTag
and VList
which
has children and renders them.