pub struct EntityDefs<E: Entity> {
complete_chunk_start_to_flattened_base: FxHashMap<E, usize>,
incomplete_chunk_start_and_flattened_base: Option<(E, usize)>,
flattened: Vec<E::Def>,
}
Expand description
Collection holding the actual definitions for Context
-allocated entities.
By design there is no way to iterate the contents of an EntityDefs
, or
generate entity indices without defining the entity in an EntityDefs
.
Fields§
§complete_chunk_start_to_flattened_base: FxHashMap<E, usize>
Entities are grouped into chunks, with per-entity-type chunk sizes
(powers of 2) specified via entities!
below.
This allows different EntityDefs
s to independently define more
entities, without losing compactness (until a whole chunk is filled).
incomplete_chunk_start_and_flattened_base: Option<(E, usize)>
Similar to a single entry in complete_chunk_start_to_flattened_base
,
but kept outside of the map for efficiency. Also, this is the only
chunk that doesn’t have its full size already (and therefore allows
defining more entities into it, without allocating new chunks).
flattened: Vec<E::Def>
All chunks’ definitions are flattened into one contiguous Vec
, where
the start of each chunk’s definitions in flattened
is indicated by
either complete_chunk_start_to_flattened_base
(for completed chunks)
or incomplete_chunk_start_and_flattened_base
.
Implementations§
Trait Implementations§
source§impl<E: Clone + Entity> Clone for EntityDefs<E>
impl<E: Clone + Entity> Clone for EntityDefs<E>
source§fn clone(&self) -> EntityDefs<E>
fn clone(&self) -> EntityDefs<E>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<E: Entity> Default for EntityDefs<E>
impl<E: Entity> Default for EntityDefs<E>
source§impl<E: Entity> Index<E> for EntityDefs<E>
impl<E: Entity> Index<E> for EntityDefs<E>
Auto Trait Implementations§
impl<E> Freeze for EntityDefs<E>where
E: Freeze,
impl<E> RefUnwindSafe for EntityDefs<E>
impl<E> Send for EntityDefs<E>
impl<E> Sync for EntityDefs<E>
impl<E> Unpin for EntityDefs<E>
impl<E> UnwindSafe for EntityDefs<E>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more