Trait Hierarchy

Source
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

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.

Implementors§