GenericNode

Trait GenericNode 

Source
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§

Source

fn element(tag: &str) -> Self

Create a new element node.

Source

fn text_node(text: &str) -> Self

Create a new text node.

Source

fn fragment() -> Self

Create a new fragment (list of nodes). A fragment is not necessarily wrapped around by an element.

Source

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.

Source

fn set_attribute(&self, name: &str, value: &str)

Sets an attribute on a node.

Source

fn append_child(&self, child: &Self)

Appends a child to the node’s children.

Source

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.

Source

fn remove_child(&self, child: &Self)

Remove a child node from this node’s children.

Source

fn replace_child(&self, old: &Self, new: &Self)

Replace a child node from this node’s children with a new child node.

Source

fn insert_sibling_before(&self, child: &Self)

Insert a new node before this node.

Source

fn parent_node(&self) -> Option<Self>

Returns the parent node, or None if detached.

Source

fn next_sibling(&self) -> Option<Self>

Returns the next sibling, or None if this node is the last sibling.

Source

fn remove_self(&self)

Remove this node from the tree.

Source

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.

Source

fn replace_children_with(&self, node: &Self)

Replace all the children in a node with a new node

Source

fn effect(&self, future: impl Future<Output = ()> + 'static)

Source

fn children(&self) -> RefCell<Vec<Self>>

Provided Methods§

Source

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.

Implementors§