Skip to main content

hierarchy_iter_depth_first

Function hierarchy_iter_depth_first 

pub fn hierarchy_iter_depth_first<R, F>(
    q: &EntitiesHolderQuery<'_, (EntityId, Option<&ChildComponent>, Option<&ParentComponent>), F>,
    root: Option<EntityId>,
    f: impl FnMut(EntityId, EntityId, &[EntityId], Option<&R>, bool) -> Option<R>,
)
where F: QueryFilter,
Expand description

f(optional parent, entity, children, cache, is_moving_to_root) -> entity cache. Called for every entity twice: moving down (cache is the parent’s) and moving to root (cache is the entity’s, result ignored).