pub struct Tree {
    pub children: Vec<Item, Global>,
}
Expand description

Root of a menu tree.

Fields

children: Vec<Item, Global>

Menu items

Implementations

Creates a new, empty tree.

Remove every children from this tree.

Inserts an item at the given position.

Inserts a delimiter at the given position.

Adds a delimiter to the end of this tree.

Adds a delimiter to the end of this tree - chainable variant.

Adds a actionnable leaf to the end of this tree.

Inserts a leaf at the given position.

Adds a actionnable leaf to the end of this tree - chainable variant.

Inserts a subtree at the given position.

Adds an item to the end of this tree.

Chainable variant.

Adds an item to the end of this tree.

Adds a submenu to the end of this tree.

Adds a submenu to the end of this tree - chainable variant.

Looks for the child at the given position.

Returns None if i >= self.len().

Returns the item at the given position.

Returns None if i > self.len() or if the item is not a subtree.

Looks for a child with the given label.

Returns None if no such label was found.

Looks for a subtree with the given label.

Returns the position of a child with the given label.

Returns None if no such label was found.

Removes the item at the given position.

Returns the number of direct children in this node.

  • Includes delimiters.
  • Does not count nested children.

Returns true if this tree has no children.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Returns the “default value” for a type. 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.

Should always be Self

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.

Calls the given closure and return the result. Read more

Calls the given closure on self.

Calls the given closure on self.

Calls the given closure if condition == true.