Trait hecs_hierarchy::Hierarchy
source · pub trait Hierarchywhere
Self: Sized,{
// Required methods
fn parent<T: Component>(&self, child: Entity) -> Result<Entity>;
fn root<T: Component>(&self, child: Entity) -> Result<Entity>;
fn children<T: Component>(&self, parent: Entity) -> ChildrenIter<'_, T> ⓘ;
fn ancestors<T: Component>(&self, child: Entity) -> AncestorIter<'_, T> ⓘ;
fn descendants_depth_first<T: Component>(
&self,
root: Entity
) -> DepthFirstIterator<'_, T> ⓘ;
fn visit<T: Component, F: Fn(&Self, Entity) -> bool + Component>(
&self,
root: Entity,
accept: F
) -> DepthFirstVisitor<'_, Self, T, F> ⓘ;
fn descendants_breadth_first<T: Component>(
&self,
root: Entity
) -> BreadthFirstIterator<'_, Self, T> ⓘ;
fn roots<T: Component>(
&self
) -> Result<QueryBorrow<'_, Without<&Parent<T>, &Child<T>>>>;
}
Expand description
Non mutating part of hierarchy
Required Methods§
sourcefn parent<T: Component>(&self, child: Entity) -> Result<Entity>
fn parent<T: Component>(&self, child: Entity) -> Result<Entity>
Returns the parent entity of child.
fn root<T: Component>(&self, child: Entity) -> Result<Entity>
sourcefn children<T: Component>(&self, parent: Entity) -> ChildrenIter<'_, T> ⓘ
fn children<T: Component>(&self, parent: Entity) -> ChildrenIter<'_, T> ⓘ
Traverses the immediate children of parent. If parent is not a Parent, an empty iterator is returned.
sourcefn ancestors<T: Component>(&self, child: Entity) -> AncestorIter<'_, T> ⓘ
fn ancestors<T: Component>(&self, child: Entity) -> AncestorIter<'_, T> ⓘ
Traverse the tree upwards. Iterator does not include the child itself.
sourcefn descendants_depth_first<T: Component>(
&self,
root: Entity
) -> DepthFirstIterator<'_, T> ⓘ
fn descendants_depth_first<T: Component>( &self, root: Entity ) -> DepthFirstIterator<'_, T> ⓘ
Traverse the tree depth first. Iterator does not include the child itself.
sourcefn visit<T: Component, F: Fn(&Self, Entity) -> bool + Component>(
&self,
root: Entity,
accept: F
) -> DepthFirstVisitor<'_, Self, T, F> ⓘ
fn visit<T: Component, F: Fn(&Self, Entity) -> bool + Component>( &self, root: Entity, accept: F ) -> DepthFirstVisitor<'_, Self, T, F> ⓘ
Traverse the tree depth first with an acceptance function
sourcefn descendants_breadth_first<T: Component>(
&self,
root: Entity
) -> BreadthFirstIterator<'_, Self, T> ⓘ
fn descendants_breadth_first<T: Component>( &self, root: Entity ) -> BreadthFirstIterator<'_, Self, T> ⓘ
Traverse the tree breadth first. Iterator does not include the child itself.
Object Safety§
This trait is not object safe.