Struct specs::world::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
sourceimpl EntitiesRes
impl EntitiesRes
sourcepub fn create(&self) -> Entity
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.
sourcepub fn create_iter(&self) -> CreateIterAtomic<'_>ⓘNotable traits for CreateIterAtomic<'a>impl<'a> Iterator for CreateIterAtomic<'a> type Item = Entity;
pub fn create_iter(&self) -> CreateIterAtomic<'_>ⓘNotable traits for CreateIterAtomic<'a>impl<'a> Iterator for CreateIterAtomic<'a> type Item = Entity;
Returns an iterator which creates
new entities atomically.
They will be persistent as soon
as you call World::maintain
.
sourcepub fn build_entity(&self) -> EntityResBuilder<'_>
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.
sourcepub fn delete(&self, e: Entity) -> Result<(), WrongGeneration>
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
.
Trait Implementations
sourceimpl Debug for EntitiesRes
impl Debug for EntitiesRes
sourceimpl Default for EntitiesRes
impl Default for EntitiesRes
sourcefn default() -> EntitiesRes
fn default() -> EntitiesRes
Returns the “default value” for a type. Read more
sourceimpl<'a> Join for &'a EntitiesRes
impl<'a> Join for &'a EntitiesRes
type Mask = BitSetOr<&'a BitSet, &'a AtomicBitSet>
type Mask = BitSetOr<&'a BitSet, &'a AtomicBitSet>
Type of joined bit mask.
type Value = &'a EntitiesRes
type Value = &'a EntitiesRes
Type of joined storages.
sourceunsafe fn open(self) -> (Self::Mask, Self)
unsafe fn open(self) -> (Self::Mask, Self)
Open this join by returning the mask and the storages. Read more
sourceunsafe fn get(v: &mut &'a EntitiesRes, idx: Index) -> Entity
unsafe fn get(v: &mut &'a EntitiesRes, idx: Index) -> Entity
Get a joined component value by a given index. Read more
sourcefn join(self) -> JoinIter<Self>ⓘNotable traits for JoinIter<J>impl<J: Join> Iterator for JoinIter<J> type Item = J::Type;
where
Self: Sized,
fn join(self) -> JoinIter<Self>ⓘNotable traits for JoinIter<J>impl<J: Join> Iterator for JoinIter<J> type Item = J::Type;
where
Self: Sized,
Create a joined iterator over the contents.
sourcefn maybe(self) -> MaybeJoin<Self> where
Self: Sized,
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
sourcefn is_unconstrained() -> bool
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. Read more
sourceimpl<'a> ParJoin for &'a EntitiesRes
impl<'a> ParJoin for &'a EntitiesRes
sourcefn par_join(self) -> JoinParIter<Self> where
Self: Sized,
fn par_join(self) -> JoinParIter<Self> where
Self: Sized,
Create a joined parallel iterator over the contents.
Auto Trait Implementations
impl RefUnwindSafe for EntitiesRes
impl Send for EntitiesRes
impl Sync for EntitiesRes
impl Unpin for EntitiesRes
impl UnwindSafe for EntitiesRes
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> TryDefault for T where
T: Default,
impl<T> TryDefault for T where
T: Default,
sourcefn try_default() -> Result<T, String>
fn try_default() -> Result<T, String>
Tries to create the default.
sourcefn unwrap_default() -> Self
fn unwrap_default() -> Self
Calls try_default
and panics on an error case.