Struct tuix::Tree [−]
pub struct Tree {
pub parent: Vec<Option<Entity>, Global>,
pub first_child: Vec<Option<Entity>, Global>,
pub next_sibling: Vec<Option<Entity>, Global>,
pub prev_sibling: Vec<Option<Entity>, Global>,
pub changed: bool,
}
Expand description
The tree describes a tree of entities
Fields
parent: Vec<Option<Entity>, Global>
first_child: Vec<Option<Entity>, Global>
next_sibling: Vec<Option<Entity>, Global>
prev_sibling: Vec<Option<Entity>, Global>
changed: bool
Implementations
impl Tree
impl Tree
pub fn get_last_child(&self, entity: Entity) -> Option<Entity>
pub fn get_last_child(&self, entity: Entity) -> Option<Entity>
Returns the last child of an entity
Returns the nth child of an entity
pub fn get_num_children(&self, entity: Entity) -> Option<u32>
pub fn get_num_children(&self, entity: Entity) -> Option<u32>
Returns the number of children of an entity
pub fn get_parent(&self, entity: Entity) -> Option<Entity>
pub fn get_parent(&self, entity: Entity) -> Option<Entity>
Returns the parent of an entity
pub fn get_first_child(&self, entity: Entity) -> Option<Entity>
pub fn get_first_child(&self, entity: Entity) -> Option<Entity>
Returns the first child of an entity or None
if there isn’t one
pub fn get_next_sibling(&self, entity: Entity) -> Option<Entity>
pub fn get_next_sibling(&self, entity: Entity) -> Option<Entity>
Returns the next sibling of an entity or None
if there isn’t one
pub fn get_prev_sibling(&self, entity: Entity) -> Option<Entity>
pub fn get_prev_sibling(&self, entity: Entity) -> Option<Entity>
Returns the previous sibling of an entity or None
if there isn’t one
pub fn is_first_child(&self, entity: Entity) -> bool
pub fn is_first_child(&self, entity: Entity) -> bool
Returns true if the entity is the first child of its parent
pub fn is_last_child(&self, entity: Entity) -> bool
pub fn is_sibling(&self, entity1: Entity, entity2: Entity) -> bool
pub fn has_children(&self, entity: Entity) -> bool
pub fn has_children(&self, entity: Entity) -> bool
Returns true if the entity has children
Removes an entity from the tree
This method assumes that a check if the entity is alive has already been done prior to calling this method
pub fn set_first_child(&mut self, entity: Entity) -> Result<(), TreeError>
pub fn set_parent(&mut self, entity: Entity, parent: Entity)
Trait Implementations
impl<'a> Hierarchy<'a> for Tree
impl<'a> Hierarchy<'a> for Tree
A type representing an iterator that walks down the visual tree
A type respresenting an iterator that walks up the visual tree
type ChildIter = ChildIterator<'a>
type ChildIter = ChildIterator<'a>
A type representing an iterator which iterates through the children of a specified node
Returns an iterator which walks down the hierarchy
Returns an iterator which walks up the hierarchy
pub fn child_iter(
&'a self,
node: <Tree as Hierarchy<'a>>::Item
) -> <Tree as Hierarchy<'a>>::ChildIter
pub fn child_iter(
&'a self,
node: <Tree as Hierarchy<'a>>::Item
) -> <Tree as Hierarchy<'a>>::ChildIter
Returns an iterator over the child nodes of a specified node
pub fn is_first_child(&self, node: <Tree as Hierarchy<'a>>::Item) -> bool
pub fn is_first_child(&self, node: <Tree as Hierarchy<'a>>::Item) -> bool
Returns true if the specified node is the first child of its parent
pub fn is_last_child(&self, node: <Tree as Hierarchy<'a>>::Item) -> bool
pub fn is_last_child(&self, node: <Tree as Hierarchy<'a>>::Item) -> bool
Returns true if the specified node is the last child of its parent
impl<'a> IntoIterator for &'a Tree
impl<'a> IntoIterator for &'a Tree
type IntoIter = TreeIterator<'a>
type IntoIter = TreeIterator<'a>
Which kind of iterator are we turning this into?
pub fn into_iter(self) -> <&'a Tree as IntoIterator>::IntoIter
pub fn into_iter(self) -> <&'a Tree as IntoIterator>::IntoIter
Creates an iterator from a value. Read more
Auto Trait Implementations
impl RefUnwindSafe for Tree
impl UnwindSafe for Tree
Blanket Implementations
Mutably borrows from an owned value. Read more