pub struct EntityStore { /* private fields */ }Expand description
Shareable, thread-safe entity store.
Structure: types → (id → data).
Implementations§
Source§impl EntityStore
impl EntityStore
Sourcepub fn list_types(&self) -> Vec<String>
pub fn list_types(&self) -> Vec<String>
Return all known entity type names.
Sourcepub fn list_entities(&self, entity_type: &str) -> Vec<(String, EntityData)>
pub fn list_entities(&self, entity_type: &str) -> Vec<(String, EntityData)>
Return every entity of the given type as (id, data) pairs.
Sourcepub fn get(&self, entity_type: &str, id: &str) -> Result<EntityData, StoreError>
pub fn get(&self, entity_type: &str, id: &str) -> Result<EntityData, StoreError>
Read a single entity.
Sourcepub fn upsert(
&self,
entity_type: &str,
id: &str,
data: EntityData,
) -> EntityData
pub fn upsert( &self, entity_type: &str, id: &str, data: EntityData, ) -> EntityData
Insert or merge-update an entity.
If the entity already exists, the provided fields are merged (shallow
merge, matching the behaviour of upsertEntity in the TypeScript core).
Trait Implementations§
Source§impl Clone for EntityStore
impl Clone for EntityStore
Source§fn clone(&self) -> EntityStore
fn clone(&self) -> EntityStore
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for EntityStore
impl Default for EntityStore
Source§fn default() -> EntityStore
fn default() -> EntityStore
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for EntityStore
impl !RefUnwindSafe for EntityStore
impl Send for EntityStore
impl Sync for EntityStore
impl Unpin for EntityStore
impl !UnwindSafe for EntityStore
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
Mutably borrows from an owned value. Read more