Struct kuchiki::Node[][src]

pub struct Node { /* fields omitted */ }

A node inside a DOM-like tree.

Methods

impl Node
[src]

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 Debug for Node
[src]

Formats the value using the given formatter. Read more

impl Drop for Node
[src]

Prevent implicit recursion when dropping nodes to avoid overflowing the stack.

The implicit drop is correct, but recursive. In the worst case (where no node has both a next sibling and a child), a tree of a few tens of thousands of nodes could cause a stack overflow.

This Drop implementations makes sure the recursion does not happen. Instead, it has an explicit Vec<Rc<Node>> stack to traverse the subtree, but only following Rc<Node> references that are "unique": that have a strong reference count of 1. Those are the nodes that would have been dropped recursively.

The stack holds ancestors of the current node rather than preceding siblings, on the assumption that large document trees are typically wider than deep.

Executes the destructor for this type. Read more

Auto Trait Implementations

impl !Send for Node

impl !Sync for Node