Struct EntitiesRes

Source
pub struct EntitiesRes { /* private fields */ }
Expand description

The entities of this ECS. This is a resource, stored in the World. If you just want to access it in your system, you can also use the Entities type def.

Please note that you should never get this mutably in a system, because it would block all the other systems.

You need to call World::maintain after creating / deleting entities with this struct.

Implementations§

Source§

impl EntitiesRes

Source

pub fn create(&self) -> Entity

Creates a new entity atomically. This will be persistent as soon as you call World::maintain.

If you want a lazy entity builder, take a look at LazyUpdate::create_entity.

In case you have access to the World, you can also use World::create_entity which creates the entity and the components immediately.

Source

pub fn create_iter(&self) -> CreateIterAtomic<'_>

Returns an iterator which creates new entities atomically. They will be persistent as soon as you call World::maintain.

Source

pub fn build_entity(&self) -> EntityResBuilder<'_>

Similar to the create method above this creates an entity atomically, and then returns a builder which can be used to insert components into various storages if available.

Source

pub fn delete(&self, e: Entity) -> Result<(), WrongGeneration>

Deletes an entity atomically. The associated components will be deleted as soon as you call World::maintain.

Source

pub fn entity(&self, id: u32) -> Entity

Returns an entity with a given id. There’s no guarantee for validity, meaning the entity could be not alive.

Source

pub fn is_alive(&self, e: Entity) -> bool

Returns true if the specified entity is alive.

Trait Implementations§

Source§

impl Debug for EntitiesRes

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for EntitiesRes

Source§

fn default() -> EntitiesRes

Returns the “default value” for a type. Read more
Source§

impl<'a> Join for &'a EntitiesRes

Source§

type Type = Entity

Type of joined components.
Source§

type Value = &'a EntitiesRes

Type of joined storages.
Source§

type Mask = BitSetOr<&'a BitSet, &'a AtomicBitSet>

Type of joined bit mask.
Source§

unsafe fn open(self) -> (<&'a EntitiesRes as Join>::Mask, &'a EntitiesRes)

Open this join by returning the mask and the storages. Read more
Source§

unsafe fn get(v: &mut &'a EntitiesRes, idx: u32) -> Entity

Get a joined component value by a given index.
Source§

fn join(self) -> JoinIter<Self>
where Self: Sized,

Create a joined iterator over the contents.
Source§

fn maybe(self) -> MaybeJoin<Self>
where Self: Sized,

Returns a Join-able structure that yields all indices, returning None for all missing elements and Some(T) for found elements. Read more
Source§

fn is_unconstrained() -> bool

If this Join typically returns all indices in the mask, then iterating over only it or combined with other joins that are also dangerous will cause the JoinIter/ParJoin to go through all indices which is usually not what is wanted and will kill performance.

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> Any for T
where T: Any,

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> TryDefault for T
where T: Default,

Source§

fn try_default() -> Result<T, String>

Tries to create the default.
Source§

fn unwrap_default() -> Self

Calls try_default and panics on an error case.
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> Erased for T

Source§

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

Source§

impl<T> Resource for T
where T: Any + Send + Sync,