pub struct SubTree { /* private fields */ }
Expand description

Represents a sub-tree in an AST A sub-tree is composed of a root with its children. The children may also have children. The maximum depth of a sub-tree is 2 (root, children and children’s children), in which case the root is always a replaceable node. The internal representation of a sub-tree is based on arrays. The organization is that a node’s children are immediately following it in the array. For example, the tree A(B(CD)E(FG)) is represented as [ABCDEFG].

Implementations§

Creates a new sub-tree with the expected size

Gets the label of the node at the given index

Sets the label of the node at the given index

Gets the tree action applied onto the node at the given index

Sets the tree action applied onto the node at the given index

Gets the number of children of the node at the given index

Sets the number of children of the node at the given index

Gets the total number of nodes in this sub-tree

Initializes the root of this sub-tree

Copy the content of this sub-tree to the given sub-tree’s buffer beginning at the given index This methods only applies in the case of a depth 1 sub-tree (only a root and its children). The results of this method in the case of a depth 2 sub-tree is undetermined.

Copy the root’s children of this sub-tree to the given sub-tree’s buffer beginning at the given index This methods only applies in the case of a depth 2 sub-tree.

Commits the children of a sub-tree in this buffer to the final ast If the index is 0, the root’s children are committed, assuming this is a depth-1 sub-tree. If not, the children of the child at the given index are committed.

Commits this buffer to the final ast

Pushes a new node into this buffer

Moves an item within the buffer

Moves a range of items within the buffer

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.