EntityStorage

Struct EntityStorage 

Source
pub struct EntityStorage {
    pub ecs: World,
    /* private fields */
}

Fields§

§ecs: World

The ECS storing all entities in the level.

Implementations§

Source§

impl EntityStorage

Source

pub unsafe fn spawn_entity_unchecked( &mut self, entity_type: &'static EntityType, pos: EntityPos, ) -> Entity

Spawn an entity in the level owning this storage, you must give its type and position, its handle is returned. If the given entity type is not supported by the level’s environment, None is returned.

§Safety:

This method is made for internal use because the entity type must be supported checked to be supported by level’s environment. The returned entity handle must also be added in the the associated chunk if existing.

§See:

Use Level::spawn_entity instead of this method if you want to avoid safety issues.

Source

pub unsafe fn add_entity_unchecked( &mut self, entity_builder: &mut EntityBuilder, ) -> Entity

Add a raw entity from a builder, this method is unsafe because the caller must ensure that the builder contains a BaseEntity component with an entity

Source

pub fn remove_entity(&mut self, entity: Entity) -> bool

Source

pub fn get_entity_ref(&self, entity: Entity) -> Option<EntityRef<'_>>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Component for T
where T: Send + Sync + 'static,