pub struct ComponentStore { /* private fields */ }Expand description
Station-local sparse component blob store.
Implementations§
Source§impl ComponentStore
impl ComponentStore
Sourcepub fn reserve_component(
&mut self,
component_id: ComponentId,
additional_entities: usize,
)
pub fn reserve_component( &mut self, component_id: ComponentId, additional_entities: usize, )
Reserves sparse blob entries for one component column.
Sourcepub fn reclaim_retained_capacity(&mut self)
pub fn reclaim_retained_capacity(&mut self)
Releases unused retained column and entity-map storage.
Sourcepub fn column_slots_capacity(&self) -> usize
pub fn column_slots_capacity(&self) -> usize
Component column slots currently retained without another allocation.
Sourcepub fn component_capacity(&self, component_id: ComponentId) -> usize
pub fn component_capacity(&self, component_id: ComponentId) -> usize
Sparse entity entries retained for one component without another rehash.
Sourcepub fn set_blob(
&mut self,
descriptor: &ComponentDescriptor,
entity: EntityHandle,
version: u64,
bytes: Vec<u8>,
) -> Result<(), ComponentStoreError>
pub fn set_blob( &mut self, descriptor: &ComponentDescriptor, entity: EntityHandle, version: u64, bytes: Vec<u8>, ) -> Result<(), ComponentStoreError>
Writes an opaque component blob.
Sourcepub fn set_blob_from_slice(
&mut self,
descriptor: &ComponentDescriptor,
entity: EntityHandle,
version: u64,
bytes: &[u8],
) -> Result<(), ComponentStoreError>
pub fn set_blob_from_slice( &mut self, descriptor: &ComponentDescriptor, entity: EntityHandle, version: u64, bytes: &[u8], ) -> Result<(), ComponentStoreError>
Copies an opaque component value into retained blob storage.
Existing blob byte capacity is reused when sufficient. Validation runs before mutation, so failed writes leave the previous value unchanged.
Sourcepub fn set_typed<T, C: ComponentCodec<T>>(
&mut self,
descriptor: &ComponentDescriptor,
entity: EntityHandle,
version: u64,
codec: &C,
value: &T,
) -> Result<(), ComponentStoreError>
pub fn set_typed<T, C: ComponentCodec<T>>( &mut self, descriptor: &ComponentDescriptor, entity: EntityHandle, version: u64, codec: &C, value: &T, ) -> Result<(), ComponentStoreError>
Encodes and writes a typed component value using codec.
Sourcepub fn set_typed_with_scratch<T, C: ComponentCodec<T>>(
&mut self,
descriptor: &ComponentDescriptor,
entity: EntityHandle,
version: u64,
codec: &C,
value: &T,
scratch: &mut ComponentEncodeScratch,
) -> Result<(), ComponentStoreError>
pub fn set_typed_with_scratch<T, C: ComponentCodec<T>>( &mut self, descriptor: &ComponentDescriptor, entity: EntityHandle, version: u64, codec: &C, value: &T, scratch: &mut ComponentEncodeScratch, ) -> Result<(), ComponentStoreError>
Encodes a typed value through caller-owned scratch and copies it into retained blob storage.
Sourcepub fn get_blob(
&self,
component_id: ComponentId,
entity: EntityHandle,
) -> Option<&ComponentBlob>
pub fn get_blob( &self, component_id: ComponentId, entity: EntityHandle, ) -> Option<&ComponentBlob>
Gets an opaque component blob.
Sourcepub fn has_dirty_selected(
&self,
entity: EntityHandle,
component_ids: &[ComponentId],
) -> bool
pub fn has_dirty_selected( &self, entity: EntityHandle, component_ids: &[ComponentId], ) -> bool
Returns whether any selected component on entity is dirty.
This is a low-level convenience for caller-owned replication eligibility rules; the store does not clear dirty state or track per-client delivery.
Sourcepub fn get_typed<T, C: ComponentCodec<T>>(
&self,
component_id: ComponentId,
entity: EntityHandle,
codec: &C,
) -> Result<T, ComponentStoreError>
pub fn get_typed<T, C: ComponentCodec<T>>( &self, component_id: ComponentId, entity: EntityHandle, codec: &C, ) -> Result<T, ComponentStoreError>
Decodes a typed component value using codec.
Sourcepub fn get_blob_mut(
&mut self,
component_id: ComponentId,
entity: EntityHandle,
) -> Option<&mut ComponentBlob>
pub fn get_blob_mut( &mut self, component_id: ComponentId, entity: EntityHandle, ) -> Option<&mut ComponentBlob>
Gets a mutable opaque component blob.
Sourcepub fn clear_dirty_for_entity(&mut self, entity: EntityHandle) -> usize
pub fn clear_dirty_for_entity(&mut self, entity: EntityHandle) -> usize
Clears dirty flags for all components on one entity.
Sourcepub fn remove_entity(
&mut self,
entity: EntityHandle,
) -> Vec<(ComponentId, ComponentBlob)>
pub fn remove_entity( &mut self, entity: EntityHandle, ) -> Vec<(ComponentId, ComponentBlob)>
Removes all component blobs for an entity and returns the removed values.
Sourcepub fn remove_entity_into(
&mut self,
entity: EntityHandle,
removed: &mut Vec<(ComponentId, ComponentBlob)>,
) -> usize
pub fn remove_entity_into( &mut self, entity: EntityHandle, removed: &mut Vec<(ComponentId, ComponentBlob)>, ) -> usize
Removes all component blobs into caller-owned reusable output storage.
Sourcepub fn clear_entity(&mut self, entity: EntityHandle) -> usize
pub fn clear_entity(&mut self, entity: EntityHandle) -> usize
Removes and drops all component blobs for an entity without output storage.
Sourcepub fn copy_for_migration(
&mut self,
registry: &ComponentRegistry,
source: EntityHandle,
target: EntityHandle,
) -> usize
pub fn copy_for_migration( &mut self, registry: &ComponentRegistry, source: EntityHandle, target: EntityHandle, ) -> usize
Copies migratable component blobs from one entity handle to another.
Sourcepub fn blob_count(&self) -> usize
pub fn blob_count(&self) -> usize
Returns number of component blobs stored in all columns.
Sourcepub fn column_count(&self) -> usize
pub fn column_count(&self) -> usize
Number of component columns currently registered in the store.
Trait Implementations§
Source§impl Clone for ComponentStore
impl Clone for ComponentStore
Source§fn clone(&self) -> ComponentStore
fn clone(&self) -> ComponentStore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more