pub struct SimpleDataStore { /* private fields */ }Expand description
A simple hashmap-backed DataStore. Clone to share the same storage.
Implementations§
Trait Implementations§
Source§impl Clone for SimpleDataStore
impl Clone for SimpleDataStore
Source§fn clone(&self) -> SimpleDataStore
fn clone(&self) -> SimpleDataStore
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl DataStore for SimpleDataStore
impl DataStore for SimpleDataStore
Source§fn read(&self, keys: &[Key]) -> Vec<Option<Value>>
fn read(&self, keys: &[Key]) -> Vec<Option<Value>>
Read several keys at once. Each entry is the key’s current value, or
None if the key is unset/absent.Source§fn write(&self, changes: StateChange) -> Result<(), DataError>
fn write(&self, changes: StateChange) -> Result<(), DataError>
Apply a batch of changes. Observers receive the same
StateChange.Source§fn slot(&self, key: &Key) -> Box<dyn Slot>
fn slot(&self, key: &Key) -> Box<dyn Slot>
Resolve a key to a direct
Slot handle (read + write the same cell
without repeating the lookup).Source§fn clone_box(&self) -> Box<dyn DataStore>
fn clone_box(&self) -> Box<dyn DataStore>
A sibling handle onto the same storage: reads and writes through the
clone coincide with the original’s. Stores share their storage across
clones by design (interior mutability,
&self everywhere), and this
puts that fact on the trait, so a holder of dyn DataStore can keep an
independent live handle — e.g. one kept aside before handing a store to
a device that takes it by value.Source§fn subscribe(&self) -> Subscription
fn subscribe(&self) -> Subscription
Subscribe to changes. Each call yields an independent
Subscription,
whose first change is the store’s whole current state: a subscriber
starts from the full picture and stays current from the changes that
follow, without a separate snapshot read that could race them.Source§impl Default for SimpleDataStore
impl Default for SimpleDataStore
Source§fn default() -> SimpleDataStore
fn default() -> SimpleDataStore
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SimpleDataStore
impl RefUnwindSafe for SimpleDataStore
impl Send for SimpleDataStore
impl Sync for SimpleDataStore
impl Unpin for SimpleDataStore
impl UnsafeUnpin for SimpleDataStore
impl UnwindSafe for SimpleDataStore
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