[][src]Struct orbtk_tree::Tree

pub struct Tree {
    pub root: Option<Entity>,
    pub overlay: Option<Entity>,
    pub children: BTreeMap<Entity, Vec<Entity>>,
    pub parent: BTreeMap<Entity, Option<Entity>>,
    // some fields omitted
}

Base data structure to manage the entities of a window in a tree based structure.

Fields

root: Option<Entity>overlay: Option<Entity>children: BTreeMap<Entity, Vec<Entity>>parent: BTreeMap<Entity, Option<Entity>>

Implementations

impl Tree[src]

pub fn new() -> Self[src]

Creates a new tree with default values.

pub fn root(&self) -> Entity[src]

Returns the root of the tree.

pub fn start_node(&self, start_node: impl Into<Entity>) -> &Self[src]

pub fn register_node(&mut self, entity: impl Into<Entity>)[src]

Registers a new entity entity as node.

pub fn set_root(&mut self, root: impl Into<Entity>)[src]

Sets the root.

pub fn set_overlay(&mut self, overlay: impl Into<Entity>)[src]

pub fn append_child(
    &mut self,
    parent: impl Into<Entity>,
    child: impl Into<Entity>
) -> Result<Entity, NotFound>
[src]

Appends a child entity to the given parent entity. Raised NotFound error if the parent is not part of the tree.

pub fn len(&self) -> usize[src]

Returns the number of all entities in the tree.

pub fn is_empty(&self) -> bool[src]

Returns true if the tree has no entities.

Trait Implementations

impl Clone for Tree[src]

impl Debug for Tree[src]

impl Default for Tree[src]

impl EntityStore for Tree[src]

impl<'a> IntoIterator for &'a Tree[src]

type Item = Entity

The type of the elements being iterated over.

type IntoIter = TreeIterator<'a>

Which kind of iterator are we turning this into?

Auto Trait Implementations

impl !RefUnwindSafe for Tree

impl Send for Tree

impl !Sync for Tree

impl Unpin for Tree

impl UnwindSafe for Tree

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<E> Component for E where
    E: Any
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.