Struct token_store::StoreProxy
[−]
[src]
pub struct StoreProxy<'store> { /* fields omitted */ }
A Proxy representing a Store
with ongoing borrows
This struct represents a handle to a store from which some values are already mutably borrowed, and as such cannot be touched.
See Store::with_value
for detailed explanation of its
use.
Methods
impl<'store> StoreProxy<'store>
[src]
fn insert<V: Any + 'static>(&mut self, value: V) -> Token<V>
[src]
Insert a new value in the proxified store
Returns a clonable token that you can later use to access this value.
fn get<V: Any + 'static>(&self, token: &Token<V>) -> &V
[src]
Access value previously inserted in the proxified store
Panics if the provided token corresponds to a value that was removed, or if this value is already borrowed.
fn get_mut<V: Any + 'static>(&mut self, token: &Token<V>) -> &mut V
[src]
Mutably access value previously inserted in the proxified store
Panics if the provided token corresponds to a value that was removed, or if this value is already borrowed.
fn remove<V: Any + 'static>(&mut self, token: Token<V>) -> V
[src]
Remove a value previously inserted in the proxified store
Panics if the provided token corresponds to a value that was already removed, or if this value is already borrowed.
fn with_value<V: Any + 'static, T, F>(&mut self, token: &Token<V>, f: F) -> T where
F: FnOnce(&mut StoreProxy, &mut V) -> T,
[src]
F: FnOnce(&mut StoreProxy, &mut V) -> T,
Create a sub-scope with access to a value
Panics if the provided token corresponds to a value that was removed, or if this value is already borrowed.
See Store::with_value
for full documentation.
Trait Implementations
impl<'a> From<&'a mut Store> for StoreProxy<'a>
[src]
fn from(store: &'a mut Store) -> StoreProxy<'a>
[src]
Performs the conversion.
impl<'a, 'b> From<&'a mut StoreProxy<'b>> for StoreProxy<'a> where
'b: 'a,
[src]
'b: 'a,
fn from(proxy: &'a mut StoreProxy<'b>) -> StoreProxy<'a>
[src]
Performs the conversion.