pub(crate) struct EntityStorage {
state: SyncRwLock<EntityStorageState>,
}Expand description
Storage for entities staged in a proto chunk.
Steel keeps proto entity staging separate from full-chunk runtime ownership:
promoted or loaded full-chunk entities are owned and ticked by WorldEntityManager.
Fields§
§state: SyncRwLock<EntityStorageState>Implementations§
Source§impl EntityStorage
impl EntityStorage
Sourcepub(crate) const fn new_closed() -> Self
pub(crate) const fn new_closed() -> Self
Creates empty storage that has already crossed the Full promotion boundary.
Sourcepub(crate) fn add(&self, entity: SharedEntity) -> EntityStorageAddResult
pub(crate) fn add(&self, entity: SharedEntity) -> EntityStorageAddResult
Tries to add an entity to proto storage.
This operation linearizes with Self::close_and_drain. If promotion
closes storage first, ownership is returned so the caller can apply its
phase-specific disposition.
Sourcepub(crate) fn close_and_drain(&self) -> Vec<SharedEntity> ⓘ
pub(crate) fn close_and_drain(&self) -> Vec<SharedEntity> ⓘ
Atomically closes proto storage and drains every staged entity.
Later adds return EntityStorageAddResult::Closed. Repeated closes
return an empty collection.
Sourcepub(crate) fn get_all(&self) -> Vec<SharedEntity> ⓘ
pub(crate) fn get_all(&self) -> Vec<SharedEntity> ⓘ
Returns all staged entities.
Sourcepub(crate) fn get_saveable_entities(&self) -> Vec<SharedEntity> ⓘ
pub(crate) fn get_saveable_entities(&self) -> Vec<SharedEntity> ⓘ
Returns staged entities that should be saved when the proto chunk is persisted.
Excludes:
- Removed entities
- Entity types with
can_serialize = false(including players)
Trait Implementations§
Source§impl Debug for EntityStorage
impl Debug for EntityStorage
Auto Trait Implementations§
impl !Freeze for EntityStorage
impl !RefUnwindSafe for EntityStorage
impl !UnwindSafe for EntityStorage
impl Send for EntityStorage
impl Sync for EntityStorage
impl Unpin for EntityStorage
impl UnsafeUnpin for EntityStorage
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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 moreArc<SyncMutex<>>