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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.