pub trait Delete {
// Required method
fn delete(&mut self, entity: EntityId) -> bool;
}Expand description
Deletes components from an entity.
Required Methods§
Sourcefn delete(&mut self, entity: EntityId) -> bool
fn delete(&mut self, entity: EntityId) -> bool
Deletes component in entity, return true if the entity had this component.
Multiple components can be deleted at the same time using a tuple.
§Example
use shipyard::{Component, Delete, 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();
assert!((&mut usizes, &mut u32s).delete(entity));