Struct shard_ecs::descriptors::archetype_descriptor::ArchetypeDescriptor [−][src]
pub struct ArchetypeDescriptor { /* fields omitted */ }
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.
pub const fn new(
archetype_id: ArchetypeId,
len: u8,
components: [ComponentDescriptor; 14]
) -> Self
pub const fn new(
archetype_id: ArchetypeId,
len: u8,
components: [ComponentDescriptor; 14]
) -> Self
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.
pub fn add_component(
&self,
component_descriptor: &ComponentDescriptor
) -> Option<ArchetypeDescriptor>
pub fn add_component(
&self,
component_descriptor: &ComponentDescriptor
) -> Option<ArchetypeDescriptor>
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 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.
Get a reference to the archetype descriptor’s components.
Trait Implementations
Performs the conversion.
Performs the conversion.
Auto Trait Implementations
impl RefUnwindSafe for ArchetypeDescriptor
impl Send for ArchetypeDescriptor
impl Sync for ArchetypeDescriptor
impl Unpin for ArchetypeDescriptor
impl UnwindSafe for ArchetypeDescriptor
Blanket Implementations
Mutably borrows from an owned value. Read more