pub trait Hierarchy
where 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§

source

fn parent<T: Component>(&self, child: Entity) -> Result<Entity>

Returns the parent entity of child.

source

fn root<T: Component>(&self, child: Entity) -> Result<Entity>

source

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.

source

fn ancestors<T: Component>(&self, child: Entity) -> AncestorIter<'_, T>

Traverse the tree upwards. Iterator does not include the child itself.

source

fn descendants_depth_first<T: Component>( &self, root: Entity ) -> DepthFirstIterator<'_, T>

Traverse the tree depth first. Iterator does not include the child itself.

source

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

source

fn descendants_breadth_first<T: Component>( &self, root: Entity ) -> BreadthFirstIterator<'_, Self, T>

Traverse the tree breadth first. Iterator does not include the child itself.

source

fn roots<T: Component>( &self ) -> Result<QueryBorrow<'_, Without<&Parent<T>, &Child<T>>>>

Returns an iterator over all root objects in the world

Object Safety§

This trait is not object safe.

Implementors§