pub trait GenericNode:
Debug
+ Clone
+ PartialEq
+ Eq
+ 'static {
Show 18 methods
// Required methods
fn element(tag: &str) -> Self;
fn text_node(text: &str) -> Self;
fn fragment() -> Self;
fn marker() -> Self;
fn set_attribute(&self, name: &str, value: &str);
fn append_child(&self, child: &Self);
fn insert_child_before(
&self,
new_node: &Self,
reference_node: Option<&Self>,
);
fn remove_child(&self, child: &Self);
fn replace_child(&self, old: &Self, new: &Self);
fn insert_sibling_before(&self, child: &Self);
fn parent_node(&self) -> Option<Self>;
fn next_sibling(&self) -> Option<Self>;
fn remove_self(&self);
fn update_inner_text(&self, text: &str);
fn replace_children_with(&self, node: &Self);
fn effect(&self, future: impl Future<Output = ()> + 'static);
fn children(&self) -> RefCell<Vec<Self>>;
// Provided method
fn append_render(&self, render: impl Render<Self> + 'static) { ... }
}Required Methods§
Sourcefn fragment() -> Self
fn fragment() -> Self
Create a new fragment (list of nodes). A fragment is not necessarily wrapped around by an element.
Sourcefn marker() -> Self
fn marker() -> Self
Create a marker (dummy) node. For [DomNode], this is implemented by creating an empty comment node.
This is used, for example, in [Keyed] and [Indexed] for scenarios where you want to push a new item to the
end of the list. If the list is empty, a dummy node is needed to store the position of the component.
Sourcefn set_attribute(&self, name: &str, value: &str)
fn set_attribute(&self, name: &str, value: &str)
Sets an attribute on a node.
Sourcefn append_child(&self, child: &Self)
fn append_child(&self, child: &Self)
Appends a child to the node’s children.
Sourcefn insert_child_before(&self, new_node: &Self, reference_node: Option<&Self>)
fn insert_child_before(&self, new_node: &Self, reference_node: Option<&Self>)
Insert a new child node to this node’s children. If reference_node is Some, the child will be inserted
before the reference node. Else if None, the child will be inserted at the end.
Sourcefn remove_child(&self, child: &Self)
fn remove_child(&self, child: &Self)
Remove a child node from this node’s children.
Sourcefn replace_child(&self, old: &Self, new: &Self)
fn replace_child(&self, old: &Self, new: &Self)
Replace a child node from this node’s children with a new child node.
Sourcefn insert_sibling_before(&self, child: &Self)
fn insert_sibling_before(&self, child: &Self)
Insert a new node before this node.
Sourcefn parent_node(&self) -> Option<Self>
fn parent_node(&self) -> Option<Self>
Returns the parent node, or None if detached.
Sourcefn next_sibling(&self) -> Option<Self>
fn next_sibling(&self) -> Option<Self>
Returns the next sibling, or None if this node is the last sibling.
Sourcefn remove_self(&self)
fn remove_self(&self)
Remove this node from the tree.
Sourcefn update_inner_text(&self, text: &str)
fn update_inner_text(&self, text: &str)
Update inner text of the node. If the node has elements, all the elements are replaced with a new text node.
Sourcefn replace_children_with(&self, node: &Self)
fn replace_children_with(&self, node: &Self)
Replace all the children in a node with a new node
fn effect(&self, future: impl Future<Output = ()> + 'static)
fn children(&self) -> RefCell<Vec<Self>>
Provided Methods§
fn append_render(&self, render: impl Render<Self> + 'static)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.