pub struct ArchetypeDescriptor { /* private fields */ }
Expand description

Represents a combination of components. Each component type MUST be unique (i.e. no duplicate component types). Length must be larger than 0 and lower or equal to MAX_COMPONENTS_PER_ENTITY. Use the ArchetypeDescriptor::is_valid function to check for validity. Any use of an invalid archetype descriptor is considered UB.

Implementations

The invalid archetype descriptor. Has 0 components and an ArchetypeId of 0.

Returns true if it is a valid archetype. A valid archetype has a length larger than 0 and smaller than MAX_COMPONENTS_PER_ENTITY. It also contains no duplicate components.

Creates a new archetype descriptor with the given id, length and components.

Computes an archetype ID, returns ArchetypeId::INVALID if given an invalid combination of components.

Returns whether the descriptor provided is contained in self. (i.e. subset inclusion) Do not provide an invalid descriptor to this!

Returns whether the descriptor provided is excluded from self. (i.e. subset exclusion) Do not provide an invalid descriptor to this!

Returns a new archetype with the given component type added to it. Returns none if the current archetype already contains the component type or it is full.

Returns a new archetype with the given component type added to it. Returns none if the current archetype already contains the component type or it is full.

Returns whether the archetype descriptor has a given component type.

Get a the archetype descriptor’s archetype id.

Get the archetype descriptor’s component count.

Get a reference to the archetype descriptor’s components. This version is const but unsafe, as length is NOT accounted for. Therefore any descriptor past the len is considered invalid or garbage data.

Safety

Data outside of the valid component descriptor range must not be modified.

Get a reference to the archetype descriptor’s components.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Converts this type into the (usually inferred) input type.
Converts this type into the (usually inferred) input type.

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.

Calls U::from(self).

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

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
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.