Trait shard_ecs::ComponentGroup[][src]

pub trait ComponentGroup<'c>: SealedComponentGroup + Sized + 'static {
    type RefTuple: 'c;
    type MutRefTuple: 'c;
    type SliceRefTuple: 'c;
    type SliceMutRefTuple: 'c;

    const LENGTH: ArchetypeComponentCount;
    const GROUP_ID: ArchetypeId;
    const ARCHETYPE_DESCRIPTOR: ArchetypeDescriptor;
    const DESCRIPTORS: &'static [ComponentDescriptor];
    const SORTED_DESCRIPTORS: &'static [ComponentDescriptor];
    const SORTED_TO_UNSORTED_MAPPING_INDICES: &'static [u8];
    const UNSORTED_TO_SORTED_MAPPING_INDICES: &'static [u8];

    unsafe fn get_unsorted_pointers_into(&mut self) -> [*mut u8; 16];
unsafe fn get_sorted_pointers_into(&mut self) -> [*mut u8; 16];
unsafe fn get_slice_unchecked(
        components: &[ComponentPool],
        len: usize
    ) -> Self::SliceRefTuple;
unsafe fn get_slice_mut_unchecked(
        components: &[ComponentPool],
        len: usize
    ) -> Self::SliceMutRefTuple; unsafe fn is_coalescable(
        current: &[ComponentPool],
        next: &[ComponentPool],
        entities_per_pool: u16
    ) -> bool { ... } }
Expand description

Represents a group of components. Used for specifying which component types should be matched in query’s.

Associated Types

Associated Constants

Amount of component types in the group.

Unique ID of the group.

Archetype descriptor representing the group.

Descriptors of the components according to the group’s type’s ordering.

Descriptors of the components sorted by their id’s. The ECS stores groups internally in this order!

Mapping from sorted to unsorted.

Mapping from unsorted to sorted.

Required methods

Returns a list of unsorted pointers into an instance of Self. This means it’s sorted according to type signature tuple element order of Self.

Safety

  • Pointers are into self, do not alias these usages of self unless known it’s safe.

Returns a list of sorted pointers into an instance of Self. This means it’s sorted according to how the ECS stores it internally.

Safety

  • Pointers are into self, do not alias these usages of self unless known it’s safe.

Returns a slice reference started at components. TODO: Does not currently take into account sorting!

Safety

  • unchecked slice, so len MUST be valid!

Returns a mutable slice reference started at components.

Safety

  • unchecked slice, so len MUST be valid!

Provided methods

Returns whether the pools in next are contiguous to next or not.

Safety

  • current and next must be equal in length, and sorted identically.
  • length the component group this function is called on is used as slice length.
  • Therefore, this function MUST only be called with pool slices of type Self!!

Implementations on Foreign Types

Implementors