[][src]Trait legion::EntitySource

pub trait EntitySource {
    fn is_archetype_match(&self, archetype: &Archetype) -> bool;
fn configure_chunk(&self, chunk: &mut ChunkBuilder);
fn types(&self) -> FnvHashSet<TypeId>;
fn is_empty(&mut self) -> bool;
fn write<'a>(
        &mut self,
        chunk: &'a mut Chunk,
        allocator: &mut EntityAllocator
    ) -> usize; }

Inserts entity data into a Chunk in a World.

Required methods

fn is_archetype_match(&self, archetype: &Archetype) -> bool

Determines if the given archetype is compatible with the data contained in the source.

fn configure_chunk(&self, chunk: &mut ChunkBuilder)

Configures a new chunk to support the data contained within this source.

fn types(&self) -> FnvHashSet<TypeId>

Gets the entity data component types contained within this source.

fn is_empty(&mut self) -> bool

Determines if the source is empty.

fn write<'a>(
    &mut self,
    chunk: &'a mut Chunk,
    allocator: &mut EntityAllocator
) -> usize

Writes as many entities into the given Chunk as possible, consuming the data in self.

The provided EntityAllocator can be used to allocate new Entity IDs.

Returns the number of entities written.

Loading content...

Implementors

Loading content...