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
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<'_> ⓘ
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
.
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§
Source§impl Debug for EntitiesRes
impl Debug for EntitiesRes
Source§impl Default for EntitiesRes
impl Default for EntitiesRes
Source§fn default() -> EntitiesRes
fn default() -> EntitiesRes
Source§impl<'a> Join for &'a EntitiesRes
impl<'a> Join for &'a EntitiesRes
Source§type Value = &'a EntitiesRes
type Value = &'a EntitiesRes
Source§unsafe fn open(self) -> (Self::Mask, Self::Value)
unsafe fn open(self) -> (Self::Mask, Self::Value)
Source§unsafe fn get(v: &mut &'a EntitiesRes, id: Index) -> Entity
unsafe fn get(v: &mut &'a EntitiesRes, id: Index) -> Entity
Source§fn join(self) -> JoinIter<Self> ⓘwhere
Self: Sized,
fn join(self) -> JoinIter<Self> ⓘwhere
Self: Sized,
Source§fn is_unconstrained() -> bool
fn is_unconstrained() -> bool
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
to go through all indices which is usually not what
is wanted and will kill performance.Source§impl<'a> LendJoin for &'a EntitiesRes
impl<'a> LendJoin for &'a EntitiesRes
Source§type Value = &'a EntitiesRes
type Value = &'a EntitiesRes
Source§unsafe fn open(self) -> (Self::Mask, Self::Value)
unsafe fn open(self) -> (Self::Mask, Self::Value)
Source§unsafe fn get<'next>(v: &'next mut &'a EntitiesRes, id: Index) -> Entity
unsafe fn get<'next>(v: &'next mut &'a EntitiesRes, id: Index) -> Entity
Source§fn lend_join(self) -> JoinLendIter<Self>where
Self: Sized,
fn lend_join(self) -> JoinLendIter<Self>where
Self: Sized,
Source§fn maybe(self) -> MaybeJoin<Self>where
Self: Sized,
fn maybe(self) -> MaybeJoin<Self>where
Self: Sized,
Join
/LendJoin
/MaybeJoin
if the
contained T
does and that yields all indices, returning None
for all
missing elements and Some(T)
for found elements. Read moreSource§fn is_unconstrained() -> bool
fn is_unconstrained() -> bool
LendJoin
typically returns all indices in the mask, then
iterating over only it or combined with other joins that are also
dangerous will cause the JoinLendIter
to go through all indices which
is usually not what is wanted and will kill performance.Source§impl<'a> ParJoin for &'a EntitiesRes
impl<'a> ParJoin for &'a EntitiesRes
Source§type Value = &'a EntitiesRes
type Value = &'a EntitiesRes
Source§unsafe fn open(self) -> (Self::Mask, Self::Value)
unsafe fn open(self) -> (Self::Mask, Self::Value)
Source§unsafe fn get(v: &&'a EntitiesRes, id: Index) -> Entity
unsafe fn get(v: &&'a EntitiesRes, id: Index) -> Entity
Source§fn par_join(self) -> JoinParIter<Self>where
Self: Sized,
fn par_join(self) -> JoinParIter<Self>where
Self: Sized,
Source§fn is_unconstrained() -> bool
fn is_unconstrained() -> bool
LendJoin
typically returns all indices in the mask, then
iterating over only it or combined with other joins that are also
dangerous will cause the JoinLendIter
to go through all indices which
is usually not what is wanted and will kill performance.impl<'a> RepeatableLendGet for &'a EntitiesRes
Auto Trait Implementations§
impl !Freeze for EntitiesRes
impl RefUnwindSafe for EntitiesRes
impl Send for EntitiesRes
impl Sync for EntitiesRes
impl Unpin for EntitiesRes
impl UnwindSafe for EntitiesRes
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> TryDefault for Twhere
T: Default,
impl<T> TryDefault for Twhere
T: Default,
Source§fn try_default() -> Result<T, String>
fn try_default() -> Result<T, String>
Source§fn unwrap_default() -> Self
fn unwrap_default() -> Self
try_default
and panics on an error case.