pub fn register_copy<T: Component + Copy>(&mut self) {
        use crate::storage::ComponentStorage;

        let type_id = ComponentTypeId::of::<T>();
        let constructor = || Box::new(T::Storage::default()) as Box<dyn UnknownComponentStorage>;
        let convert = Box::new(
            move |src_entities: Range<usize>,
                  src_arch: &Archetype,
                  src: &dyn UnknownComponentStorage,
                  dst: &mut ArchetypeWriter<'_>| {
                let src = src.downcast_ref::<T::Storage>().unwrap();
                let mut dst = dst.claim_components::<T>();

                let src_slice = &src.get(src_arch.index()).unwrap().into_slice()[src_entities];
                unsafe { dst.extend_memcopy(src_slice.as_ptr(), src_slice.len()) };
            },
        );

        self.duplicate_fns
            .insert(type_id, (type_id, constructor, convert));
    }
/// Allows the merger to copy the given component into the destination world.
Allows the merger to copy the given component into the destination world.
Allows the merger to copy the given component into the destination world .
pub fn register_copy<T: Component + Copy>(&mut self) {
        use crate::storage::ComponentStorage;
        let type_id = ComponentTypeId::of::<T>();
        let constructor = || Box::new(T::Storage::default()) as Box<dyn UnknownComponentStorage>;
        let convert = Box::new(
            move |src_entities: Range<usize>,
                  src_arch: &Archetype,
                  src: &dyn UnknownComponentStorage,
                  dst: &mut ArchetypeWriter<'_>| {
                let src = src.downcast_ref::<T::Storage>().unwrap();
                let mut dst = dst.claim_components::<T>();
                let src_slice = &src.get(src_arch.index()).unwrap().into_slice()[src_entities];
                unsafe { dst.extend_memcopy(src_slice.as_ptr(), src_slice.len()) };
            },
        );
        self.duplicate_fns
            .insert(type_id, (type_id, constructor, convert));
    }
pub fn register_copy < T : Component + Copy > ( & mut self ) { use crate :: storage :: ComponentStorage ; let type_id = ComponentTypeId :: of :: < T > ( ) ; let constructor = | | Box :: new ( T :: Storage :: default ( ) ) as Box < dyn UnknownComponentStorage > ; let convert = Box :: new ( move | src_entities : Range < usize > , src_arch : & Archetype , src : & dyn UnknownComponentStorage , dst : & mut ArchetypeWriter < ' _ > | { let src = src . downcast_ref :: < T :: Storage > ( ) . unwrap ( ) ; let mut dst = dst . claim_components :: < T > ( ) ; let src_slice = & src . get ( src_arch . index ( ) ) . unwrap ( ) . into_slice ( ) [ src_entities ] ; unsafe { dst . extend_memcopy ( src_slice . as_ptr ( ) , src_slice . len ( ) ) } ; } , ) ; self . duplicate_fns . insert ( type_id , ( type_id , constructor , convert ) ) ; }
Allows the merger to copy the given component into the destination world.
Allows the merger to copy the given component into the destination world .
&mut self
&mut self