Struct orange_trees::Node[][src]

pub struct Node<U, T> { /* fields omitted */ }
Expand description

Node

Describes a node inside the Tree U: is the type for the node indentifier (must implement PartialEq) T: is the type for the node value

Implementations

new

Instantiates a new Node. In order to use query methods the ID should be unique for each node in the tree

with_children

Sets Node children

with_child

Create a new child in this Node

id

Get reference to id

value

Get reference to node value

children

Returns a reference to the node’s children

iter

Returns an iterator over node’s children

iter_mut

Returns a mutable iterator over node’s children

add_child

Add a child to the node

remove_child

Remove child from node

clear

Clear node children

truncate

Truncate tree at depth. If depth is 0, node’s children will be cleared

sort

Sort node children by predicate

is_leaf

Returns whether this node is a leaf (which means it has no children)

query

Search for id inside Node and return a reference to it, if exists

query_mut

Search for id inside Node and return a mutable reference to it, if exists

find

Find a node, in this branch, by predicate.

count

Count items in tree (including self)

depth

Calculate the maximum depth of the tree

parent

Get parent node of id

siblings

Get siblings for provided node

node_by_route

Given a vector of indexes, returns the node associated to the route

route_by_node

Calculate the route of a node by its id

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

This method tests for !=.

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

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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.