logo
pub struct Entity {
    pub id: EntityID,
    pub parent: Option<EntityID>,
    pub first_child: Option<EntityID>,
    pub next: Option<EntityID>,
    pub first_component: Option<Component>,
    pub z_order: i32,
    pub order_of_arrival: i32,
    pub global_order_of_arrival: i32,
}
Expand description

A node in the entity hierarchy, and a collection of components.

To iterate over the hierarchy, use the parent, first_child, next and first_component fields. For example:

Fields

id: EntityIDparent: Option<EntityID>

This entity’s parent

first_child: Option<EntityID>

This entity’s first child

next: Option<EntityID>

This entity’s next sibling, for iteration

first_component: Option<Component>

This entity’s first component

z_order: i32order_of_arrival: i32global_order_of_arrival: i32

Implementations

Add a component to this entity. Any previous component of this type will be replaced. @returns This instance, for chaining.

Remove a component from this entity. @return Whether the component was removed.

Gets a component by name from this entity. Adds a child to this entity. @param append Whether to add the entity to the end or beginning of the child list. @returns This instance, for chaining.

Dispose all of this entity’s children, without touching its own components or removing itself from its parent.

Trait Implementations

Converts this type into a shared reference of the (usually inferred) input type.

Converts this type into a shared reference of the (usually inferred) input type.

Converts this type into a shared reference of the (usually inferred) input type.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Formats the value using the given formatter. Read more

Removes this entity from its parent, and disposes all its components and children.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Typed getter

Inspect the context.

Inspect the context.

Inspect the context.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Convert into color

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Sets value as a parameter of self.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.