Trait hecs_hierarchy::Hierarchy
source ·
[−]pub trait Hierarchy where
Self: Sized, {
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>ⓘNotable traits for ChildrenIter<'a, T>impl<'a, T> Iterator for ChildrenIter<'a, T> where
T: Component, type Item = Entity;
;
fn ancestors<T: Component>(&self, child: Entity) -> AncestorIter<'_, T>ⓘNotable traits for AncestorIter<'a, T>impl<'a, T: Component> Iterator for AncestorIter<'a, T> type Item = Entity;
;
fn descendants_depth_first<T: Component>(
&self,
root: Entity
) -> DepthFirstIterator<'_, T>ⓘNotable traits for DepthFirstIterator<'a, T>impl<'a, T: Component> Iterator for DepthFirstIterator<'a, T> type Item = Entity;
;
fn visit<T: Component, F: Fn(&Self, Entity) -> bool + Component>(
&self,
root: Entity,
accept: F
) -> DepthFirstVisitor<'_, Self, T, F>ⓘNotable traits for DepthFirstVisitor<'a, W, T, F>impl<'a, F: Fn(&W, Entity) -> bool + Component, W: GenericWorld, T: Component> Iterator for DepthFirstVisitor<'a, W, T, F> type Item = Entity;
;
fn descendants_breadth_first<T: Component>(
&self,
root: Entity
) -> BreadthFirstIterator<'_, Self, T>ⓘNotable traits for BreadthFirstIterator<'a, W, T>impl<'a, W: GenericWorld + Hierarchy, T: 'static + Send + Sync> Iterator for BreadthFirstIterator<'a, W, T> type Item = Entity;
;
fn roots<T: Component>(
&self
) -> Result<QueryBorrow<'_, Without<Child<T>, &Parent<T>>>>;
}
Expand description
Non mutating part of hierarchy
Required methods
Returns the parent entity of child.
fn children<T: Component>(&self, parent: Entity) -> ChildrenIter<'_, T>ⓘNotable traits for ChildrenIter<'a, T>impl<'a, T> Iterator for ChildrenIter<'a, T> where
T: Component, type Item = Entity;
fn children<T: Component>(&self, parent: Entity) -> ChildrenIter<'_, T>ⓘNotable traits for ChildrenIter<'a, T>impl<'a, T> Iterator for ChildrenIter<'a, T> where
T: Component, type Item = Entity;
Notable traits for ChildrenIter<'a, T>
impl<'a, T> Iterator for ChildrenIter<'a, T> where
T: Component, type Item = Entity;
Traverses the immediate children of parent. If parent is not a Parent, an empty iterator is returned.
fn ancestors<T: Component>(&self, child: Entity) -> AncestorIter<'_, T>ⓘNotable traits for AncestorIter<'a, T>impl<'a, T: Component> Iterator for AncestorIter<'a, T> type Item = Entity;
fn ancestors<T: Component>(&self, child: Entity) -> AncestorIter<'_, T>ⓘNotable traits for AncestorIter<'a, T>impl<'a, T: Component> Iterator for AncestorIter<'a, T> type Item = Entity;
Notable traits for AncestorIter<'a, T>
impl<'a, T: Component> Iterator for AncestorIter<'a, T> type Item = Entity;
Traverse the tree upwards. Iterator does not include the child itself.
fn descendants_depth_first<T: Component>(
&self,
root: Entity
) -> DepthFirstIterator<'_, T>ⓘNotable traits for DepthFirstIterator<'a, T>impl<'a, T: Component> Iterator for DepthFirstIterator<'a, T> type Item = Entity;
fn descendants_depth_first<T: Component>(
&self,
root: Entity
) -> DepthFirstIterator<'_, T>ⓘNotable traits for DepthFirstIterator<'a, T>impl<'a, T: Component> Iterator for DepthFirstIterator<'a, T> type Item = Entity;
Notable traits for DepthFirstIterator<'a, T>
impl<'a, T: Component> Iterator for DepthFirstIterator<'a, T> type Item = Entity;
Traverse the tree depth first. Iterator does not include the child itself.
fn visit<T: Component, F: Fn(&Self, Entity) -> bool + Component>(
&self,
root: Entity,
accept: F
) -> DepthFirstVisitor<'_, Self, T, F>ⓘNotable traits for DepthFirstVisitor<'a, W, T, F>impl<'a, F: Fn(&W, Entity) -> bool + Component, W: GenericWorld, T: Component> Iterator for DepthFirstVisitor<'a, W, T, F> type Item = Entity;
fn visit<T: Component, F: Fn(&Self, Entity) -> bool + Component>(
&self,
root: Entity,
accept: F
) -> DepthFirstVisitor<'_, Self, T, F>ⓘNotable traits for DepthFirstVisitor<'a, W, T, F>impl<'a, F: Fn(&W, Entity) -> bool + Component, W: GenericWorld, T: Component> Iterator for DepthFirstVisitor<'a, W, T, F> type Item = Entity;
Notable traits for DepthFirstVisitor<'a, W, T, F>
impl<'a, F: Fn(&W, Entity) -> bool + Component, W: GenericWorld, T: Component> Iterator for DepthFirstVisitor<'a, W, T, F> type Item = Entity;
Traverse the tree depth first with an acceptance function
fn descendants_breadth_first<T: Component>(
&self,
root: Entity
) -> BreadthFirstIterator<'_, Self, T>ⓘNotable traits for BreadthFirstIterator<'a, W, T>impl<'a, W: GenericWorld + Hierarchy, T: 'static + Send + Sync> Iterator for BreadthFirstIterator<'a, W, T> type Item = Entity;
fn descendants_breadth_first<T: Component>(
&self,
root: Entity
) -> BreadthFirstIterator<'_, Self, T>ⓘNotable traits for BreadthFirstIterator<'a, W, T>impl<'a, W: GenericWorld + Hierarchy, T: 'static + Send + Sync> Iterator for BreadthFirstIterator<'a, W, T> type Item = Entity;
Notable traits for BreadthFirstIterator<'a, W, T>
impl<'a, W: GenericWorld + Hierarchy, T: 'static + Send + Sync> Iterator for BreadthFirstIterator<'a, W, T> type Item = Entity;
Traverse the tree breadth first. Iterator does not include the child itself.