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§
Source§impl Duplicate
impl Duplicate
Sourcepub fn register_copy<T>(&mut self)
pub fn register_copy<T>(&mut self)
Allows the merger to copy the given component into the destination world.
Sourcepub fn register_clone<T>(&mut self)
pub fn register_clone<T>(&mut self)
Allows the merger to clone the given component into the destination world.
Sourcepub fn register_convert<Source, Target, F>(&mut self, convert: F)
pub fn register_convert<Source, Target, F>(&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 + 'static), &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 + 'static), &mut ArchetypeWriter<'_>)>, )
Allows the merger to clone the given component into the destination world with a custom clone function.
Trait Implementations§
Source§impl Merger for Duplicate
impl Merger for Duplicate
Source§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.
Source§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.
Source§fn prefers_new_archetype() -> bool
fn prefers_new_archetype() -> bool
Indicates if the merger prefers to merge into a new empty archetype.
Source§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.
Auto Trait Implementations§
impl Freeze for Duplicate
impl !RefUnwindSafe for Duplicate
impl !Send for Duplicate
impl !Sync for Duplicate
impl Unpin for Duplicate
impl !UnwindSafe for Duplicate
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
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
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.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
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.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>
Converts
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>
Converts
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