pub trait Remove {
    type Out;

    fn remove(&mut self, entity: EntityId) -> Self::Out;
}
Expand description

Removes component from entities.

Required Associated Types

Type of the removed component.

Required Methods

Removes component in entity, if the entity had a component, they will be returned.
Multiple components can be removed at the same time using a tuple.

Example
use shipyard::{Component, Remove, ViewMut, World};

#[derive(Component, Debug, PartialEq, Eq)]
struct U32(u32);

#[derive(Component, Debug, PartialEq, Eq)]
struct USIZE(usize);

let mut world = World::new();

let entity = world.add_entity((USIZE(0), U32(1)));

let (mut usizes, mut u32s) = world.borrow::<(ViewMut<USIZE>, ViewMut<U32>)>().unwrap();

let old = (&mut usizes, &mut u32s).remove(entity);
assert_eq!(old, (Some(USIZE(0)), Some(U32(1))));

Implementations on Foreign Types

Implementors