pub trait Merger {
fn merge_archetype(
&mut self,
src_entity_range: Range<usize>,
src_arch: &Archetype,
src_components: &Components,
dst: &mut ArchetypeWriter<'_>
);
fn prefers_new_archetype() -> bool { ... }
fn entity_map(&mut self) -> EntityRewrite { ... }
fn assign_id(
&mut self,
existing: Entity,
allocator: &mut Allocate
) -> Entity { ... }
fn convert_layout(&mut self, source_layout: EntityLayout) -> EntityLayout { ... }
}
Expand description
Describes how to merge two Worlds.
Required methods
fn merge_archetype(
&mut self,
src_entity_range: Range<usize>,
src_arch: &Archetype,
src_components: &Components,
dst: &mut ArchetypeWriter<'_>
)
fn merge_archetype(
&mut self,
src_entity_range: Range<usize>,
src_arch: &Archetype,
src_components: &Components,
dst: &mut ArchetypeWriter<'_>
)
Merges an archetype from the source world into the destination world.
Provided methods
fn prefers_new_archetype() -> bool
fn prefers_new_archetype() -> bool
Indicates if the merger prefers to merge into a new empty archetype.
fn entity_map(&mut self) -> EntityRewrite
fn entity_map(&mut self) -> EntityRewrite
Indicates how the merger wishes entity IDs to be adjusted while cloning a world.
Returns the ID to use in the destination world when cloning the given entity.
fn convert_layout(&mut self, source_layout: EntityLayout) -> EntityLayout
fn convert_layout(&mut self, source_layout: EntityLayout) -> EntityLayout
Calculates the destination entity layout for the given source layout.