pub struct ComponentNode {
pub guid: Uuid,
pub component_type: String,
pub name: String,
pub classes: Vec<String>,
pub component: Box<dyn Component>,
pub parent: Option<ComponentId>,
pub children: Vec<ComponentId>,
pub initialized: bool,
}Expand description
World-owned record for a component payload plus its topology.
This is the building block of the component-centric ECS: a single flat store of records
in World, each record carrying its own parent/children handles.
Fields§
§guid: Uuid§component_type: StringEngine-side type identifier from Component::name() (e.g. "transform", "text").
Set at construction, never changes.
name: StringUser-assigned label for this node (e.g. name = "catgirl" in MMS).
Defaults to empty. Used for #label query selectors.
classes: Vec<String>CSS-style class membership (e.g. class = "avatar" in MMS).
Used for .class query selectors.
component: Box<dyn Component>§parent: Option<ComponentId>§children: Vec<ComponentId>§initialized: boolImplementations§
Source§impl ComponentNode
impl ComponentNode
pub fn new(component: Box<dyn Component>) -> Self
Sourcepub fn new_named(name: impl Into<String>, component: Box<dyn Component>) -> Self
pub fn new_named(name: impl Into<String>, component: Box<dyn Component>) -> Self
Create a node with a user-assigned label (name).
component_type is still derived from component.name().
pub fn new_with_guid_named( guid: Uuid, name: impl Into<String>, component: Box<dyn Component>, ) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for ComponentNode
impl !Send for ComponentNode
impl !Sync for ComponentNode
impl !UnwindSafe for ComponentNode
impl Freeze for ComponentNode
impl Unpin for ComponentNode
impl UnsafeUnpin for ComponentNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.