#specs #scenegraph #hierarchy


Scene graph type hierarchy abstraction for use with specs

16 unstable releases (5 breaking)

Uses old Rust 2015

0.6.0 Feb 12, 2020
0.5.1 Jul 23, 2019
0.4.0 Jul 9, 2019
0.3.0 Nov 6, 2018
0.2.0 Jul 11, 2018

#699 in Science

Download history 1265/week @ 2023-11-03 1095/week @ 2023-11-10 1484/week @ 2023-11-17 1237/week @ 2023-11-24 657/week @ 2023-12-01 1081/week @ 2023-12-08 1254/week @ 2023-12-15 1043/week @ 2023-12-22 670/week @ 2023-12-29 1100/week @ 2024-01-05 1210/week @ 2024-01-12 1086/week @ 2024-01-19 970/week @ 2024-01-26 545/week @ 2024-02-02 1301/week @ 2024-02-09 1356/week @ 2024-02-16

4,244 downloads per month
Used in 67 crates (6 directly)


509 lines


Build Status Crates.io Gitter MIT/Apache Docs.rs LoC

Scene graph type hierarchy abstraction for use with specs.

Builds up a Hierarchy resource, by querying a user supplied Parent component. Requires the component to be Tracked.

Will send modification events on an internal EventChannel. Note that Removed events does not mean the Parent component was removed from the component storage, just that the Entity will no longer be considered to be a part of the Hierarchy. This is because the user may wish to either remove only the component, the complete Entity, or something completely different. When an Entity that is a parent gets removed from the hierarchy, the full tree of children below it will also be removed from the hierarchy.


# Cargo.toml
specs-hierarchy = "0.5.1"


use specs::prelude::{Component, DenseVecStorage, Entity, FlaggedStorage};
use specs_hierarchy::{Hierarchy, Parent as HParent};

/// Component for defining a parent entity.
/// The entity with this component *has* a parent, rather than *is* a parent.
#[derive(Debug, Clone, Eq, Ord, PartialEq, PartialOrd)]
pub struct Parent {
    /// The parent entity
    pub entity: Entity,

impl Component for Parent {
    type Storage = FlaggedStorage<Self, DenseVecStorage<Self>>;

impl HParent for Parent {
    fn parent_entity(&self) -> Entity {


Licensed under either of

at your option.


We are a community project that welcomes contribution from anyone. If you're interested in helping out, you can contact us either through GitHub, or via gitter.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


~87K SLoC