pub fn with<C: 'static>(self, component: C) -> Self {
        let bytes = unsafe {
            slice::from_raw_parts(&component as *const C as *const u8, mem::size_of::<C>())
        };
        let offset = self.container.temp_data.len();

        if let hash_map::Entry::Vacant(e) = self.container.temp_offsets.entry(component.type_id()) {
            self.container.temp_data.extend(bytes);
            e.insert((offset, mem::size_of_val(&component)));
            mem::forget(component);
        }

        self
    }
/// Adds a component to the entity. Adding already present component will have no effect.
Adds a component to the entity. Adding already present component will have no effect.
Adds a component to the entity . Adding already present component will have no effect .
pub fn with<C: 'static>(self, component: C) -> Self {
        let bytes = unsafe {
            slice::from_raw_parts(&component as *const C as *const u8, mem::size_of::<C>())
        };
        let offset = self.container.temp_data.len();
        if let hash_map::Entry::Vacant(e) = self.container.temp_offsets.entry(component.type_id()) {
            self.container.temp_data.extend(bytes);
            e.insert((offset, mem::size_of_val(&component)));
            mem::forget(component);
        }
        self
    }
pub fn with < C : ' static > ( self , component : C ) -> Self { let bytes = unsafe { slice :: from_raw_parts ( & component as * const C as * const u8 , mem :: size_of :: < C > ( ) ) } ; let offset = self . container . temp_data . len ( ) ; if let hash_map :: Entry :: Vacant ( e ) = self . container . temp_offsets . entry ( component . type_id ( ) ) { self . container . temp_data . extend ( bytes ) ; e . insert ( ( offset , mem :: size_of_val ( & component ) ) ) ; mem :: forget ( component ) ; } self }
Adds a component to the entity.
Adds a component to the entity .
self
component
C
self
component
C