Struct kuchiki::NodeRef [] [src]

pub struct NodeRef(pub Rc<Node>);

A strong reference to a node.

A node is destroyed when the last strong reference to it dropped.

Each node holds a strong reference to its first child and next sibling (if any), but only a weak reference to its last child, previous sibling, and parent. This is to avoid strong reference cycles, which would cause memory leaks.

As a result, a single NodeRef is sufficient to keep alive a node and nodes that are after it in tree order (its descendants, its following siblings, and their descendants) but not other nodes in a tree.

To avoid detroying nodes prematurely, programs typically hold a strong reference to the root of a document until they’re done with that document.

Methods

impl NodeRef
[src]

Return an iterator of references to this node and its ancestors.

Return an iterator of references to this node’s ancestors.

Return an iterator of references to this node and the siblings before it.

Return an iterator of references to this node’s siblings before it.

Return an iterator of references to this node and the siblings after it.

Return an iterator of references to this node’s siblings after it.

Return an iterator of references to this node’s children.

Return an iterator of references to this node and its descendants, in tree order.

Parent nodes appear before the descendants.

Note: this is the NodeEdge::Start items from traverse().

Return an iterator of references to this node’s descendants, in tree order.

Parent nodes appear before the descendants.

Note: this is the NodeEdge::Start items from traverse().

Return an iterator of the start and end edges of this node and its descendants, in tree order.

Return an iterator of the start and end edges of this node’s descendants, in tree order.

Return an iterator of the inclusive descendants element that match the given selector list.

impl NodeRef
[src]

If this node is an element, return a strong reference to element-specific data.

If this node is a text node, return a strong reference to its contents.

If this node is a comment, return a strong reference to its contents.

If this node is a doctype, return a strong reference to doctype-specific data.

If this node is a document, return a strong reference to document-specific data.

impl NodeRef
[src]

Serialize this node and its descendants in HTML syntax to the given stream.

Serialize this node and its descendants in HTML syntax to a new file at the given path.

impl NodeRef
[src]

Create a new node.

Create a new element node.

Create a new text node.

Create a new comment node.

Create a new processing instruction node.

Create a new doctype node.

Create a new document node.

Return the concatenation of all text nodes in this subtree.

impl NodeRef
[src]

Append a new child to this node, after existing children.

The new child is detached from its previous position.

Prepend a new child to this node, before existing children.

The new child is detached from its previous position.

Insert a new sibling after this node.

The new sibling is detached from its previous position.

Insert a new sibling before this node.

The new sibling is detached from its previous position.

Methods from Deref<Target = Node>

Return a reference to this node’s node-type-specific data.

If this node is an element, return a reference to element-specific data.

If this node is a text node, return a reference to its contents.

If this node is a comment, return a reference to its contents.

If this node is a document, return a reference to doctype-specific data.

If this node is a document, return a reference to document-specific data.

Return a reference to the parent node, unless this node is the root of the tree.

Return a reference to the first child of this node, unless it has no child.

Return a reference to the last child of this node, unless it has no child.

Return a reference to the previous sibling of this node, unless it is a first child.

Return a reference to the previous sibling of this node, unless it is a last child.

Detach a node from its parent and siblings. Children are not affected.

To remove a node and its descendants, detach it and drop any strong reference to it.

Trait Implementations

impl Serialize for NodeRef
[src]

impl ToString for NodeRef
[src]

Converts the given value to a String. Read more

impl Clone for NodeRef
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for NodeRef
[src]

Formats the value using the given formatter.

impl Deref for NodeRef
[src]

The resulting type after dereferencing

The method called to dereference a value

impl Eq for NodeRef
[src]

impl PartialEq for NodeRef
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.