pub struct DataStoreRegistry(/* private fields */);Expand description
DataStoreRegistry
Implementations§
Methods from Deref<Target = StoreRegistry<DataStore>>§
Sourcepub fn iter(
&self,
) -> impl Iterator<Item = (&'static str, &'static LocalKey<RefCell<T>>)>
pub fn iter( &self, ) -> impl Iterator<Item = (&'static str, &'static LocalKey<RefCell<T>>)>
Iterate registered store names and thread-local keys.
Sourcepub fn for_each<R>(&self, f: impl FnMut(&'static str, &T) -> R)
pub fn for_each<R>(&self, f: impl FnMut(&'static str, &T) -> R)
Borrow each registered store immutably.
Sourcepub fn register(
&mut self,
name: &'static str,
accessor: &'static LocalKey<RefCell<T>>,
)
pub fn register( &mut self, name: &'static str, accessor: &'static LocalKey<RefCell<T>>, )
Register a thread-local store accessor under a path.
Sourcepub fn try_get_store(
&self,
path: &str,
) -> Result<&'static LocalKey<RefCell<T>>, RuntimeError>
pub fn try_get_store( &self, path: &str, ) -> Result<&'static LocalKey<RefCell<T>>, RuntimeError>
Look up a store accessor by path.
Sourcepub fn with_store<R>(
&self,
path: &str,
f: impl FnOnce(&T) -> R,
) -> Result<R, RuntimeError>
pub fn with_store<R>( &self, path: &str, f: impl FnOnce(&T) -> R, ) -> Result<R, RuntimeError>
Borrow a store immutably by path.
Sourcepub fn with_store_mut<R>(
&self,
path: &str,
f: impl FnOnce(&mut T) -> R,
) -> Result<R, RuntimeError>
pub fn with_store_mut<R>( &self, path: &str, f: impl FnOnce(&mut T) -> R, ) -> Result<R, RuntimeError>
Borrow a store mutably by path.
Trait Implementations§
Source§impl Deref for DataStoreRegistry
impl Deref for DataStoreRegistry
Auto Trait Implementations§
impl Freeze for DataStoreRegistry
impl RefUnwindSafe for DataStoreRegistry
impl Send for DataStoreRegistry
impl Sync for DataStoreRegistry
impl Unpin for DataStoreRegistry
impl UnwindSafe for DataStoreRegistry
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