pub struct Duplicate { /* private fields */ }
Expand description
A Merger
which clones entities from the source world into the destination,
potentially performing data transformations in the process.
Implementations
sourceimpl Duplicate
impl Duplicate
sourcepub fn register_copy<T: Component + Copy>(&mut self)
pub fn register_copy<T: Component + Copy>(&mut self)
Allows the merger to copy the given component into the destination world.
sourcepub fn register_clone<T: Component + Clone>(&mut self)
pub fn register_clone<T: Component + Clone>(&mut self)
Allows the merger to clone the given component into the destination world.
sourcepub fn register_convert<Source: Component, Target: Component, F: FnMut(&Source) -> Target + 'static>(
&mut self,
convert: F
)
pub fn register_convert<Source: Component, Target: Component, F: FnMut(&Source) -> Target + 'static>(
&mut self,
convert: F
)
Allows the merger to clone the given component into the destination world with a custom clone function.
sourcepub fn register_convert_raw(
&mut self,
src_type: ComponentTypeId,
dst_type: ComponentTypeId,
constructor: fn() -> Box<dyn UnknownComponentStorage>,
duplicate_fn: Box<dyn FnMut(Range<usize>, &Archetype, &dyn UnknownComponentStorage, &mut ArchetypeWriter<'_>)>
)
pub fn register_convert_raw(
&mut self,
src_type: ComponentTypeId,
dst_type: ComponentTypeId,
constructor: fn() -> Box<dyn UnknownComponentStorage>,
duplicate_fn: Box<dyn FnMut(Range<usize>, &Archetype, &dyn UnknownComponentStorage, &mut ArchetypeWriter<'_>)>
)
Allows the merger to clone the given component into the destination world with a custom clone function.
Trait Implementations
sourceimpl Merger for Duplicate
impl Merger for Duplicate
sourcefn 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.
sourcefn 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.
sourcefn prefers_new_archetype() -> bool
fn prefers_new_archetype() -> bool
Indicates if the merger prefers to merge into a new empty archetype.
sourcefn 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.
Auto Trait Implementations
impl !RefUnwindSafe for Duplicate
impl !Send for Duplicate
impl !Sync for Duplicate
impl Unpin for Duplicate
impl !UnwindSafe for Duplicate
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
sourcepub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
sourcepub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
sourcepub fn as_any(&self) -> &(dyn Any + 'static)
pub fn as_any(&self) -> &(dyn Any + 'static)
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
sourcepub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more