pub struct SharedStorageImpl { /* private fields */ }Available on crate feature
shared_storage_impl only.Expand description
An implementation of type-based shared storage.
See SharedStorage for more info.
See also Fork, Update, Join.
§Internal Structure
Item entries are stored in Arc<std::sync::Mutex<HashMap<TypeId, StorageItem>>> which is cloned in Fork and shared between branches.
StorageItem has type Arc<async_lock::RwLock<...>> which allows for per entry locking without holding a lock for the entire HashMap.
Implementations§
Trait Implementations§
Source§fn clone(&self) -> SharedStorageImpl
fn clone(&self) -> SharedStorageImpl
Returns a duplicate 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§fn default() -> SharedStorageImpl
fn default() -> SharedStorageImpl
Returns the “default value” for a type. Read more
Source§fn get<T>(&self) -> impl Future<Output = Option<impl Deref<Target = T>>> + Sendwhere
T: 'static,
fn get<T>(&self) -> impl Future<Output = Option<impl Deref<Target = T>>> + Sendwhere
T: 'static,
Gets reference of a value with type
T from storage if it is present. Read moreSource§fn get_mut<T>(
&mut self,
) -> impl Future<Output = Option<impl DerefMut<Target = T>>> + Sendwhere
T: 'static,
fn get_mut<T>(
&mut self,
) -> impl Future<Output = Option<impl DerefMut<Target = T>>> + Sendwhere
T: 'static,
Gets mutable reference of a value with type
T from storage if it is present. Read moreSource§fn insert<T>(&mut self, val: T) -> impl Future<Output = Option<T>> + Send
fn insert<T>(&mut self, val: T) -> impl Future<Output = Option<T>> + Send
Inserts value with type
T to storage and returns the value that was there previously if it was there. Read moreSource§fn update_from(&mut self, _other: Self)
fn update_from(&mut self, _other: Self)
Auto Trait Implementations§
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