Trait cached::CachedAsync
source · pub trait CachedAsync<K, V> {
// Required methods
fn get_or_set_with<'life0, 'async_trait, F, Fut>(
&'life0 mut self,
k: K,
f: F
) -> Pin<Box<dyn Future<Output = &mut V> + Send + 'async_trait>>
where V: Send,
F: FnOnce() -> Fut + Send + 'async_trait,
Fut: Future<Output = V> + Send + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait;
fn try_get_or_set_with<'life0, 'async_trait, F, Fut, E>(
&'life0 mut self,
k: K,
f: F
) -> Pin<Box<dyn Future<Output = Result<&mut V, E>> + Send + 'async_trait>>
where V: Send,
F: FnOnce() -> Fut + Send + 'async_trait,
Fut: Future<Output = Result<V, E>> + Send + 'async_trait,
E: 'async_trait,
Self: 'async_trait,
'life0: 'async_trait;
}
Available on crate feature
async
only.Required Methods§
fn get_or_set_with<'life0, 'async_trait, F, Fut>( &'life0 mut self, k: K, f: F ) -> Pin<Box<dyn Future<Output = &mut V> + Send + 'async_trait>>
fn try_get_or_set_with<'life0, 'async_trait, F, Fut, E>( &'life0 mut self, k: K, f: F ) -> Pin<Box<dyn Future<Output = Result<&mut V, E>> + Send + 'async_trait>>
Object Safety§
This trait is not object safe.
Implementations on Foreign Types§
source§impl<K, V, S> CachedAsync<K, V> for HashMap<K, V, S>
impl<K, V, S> CachedAsync<K, V> for HashMap<K, V, S>
source§fn get_or_set_with<'life0, 'async_trait, F, Fut>(
&'life0 mut self,
k: K,
f: F
) -> Pin<Box<dyn Future<Output = &mut V> + Send + 'async_trait>>
fn get_or_set_with<'life0, 'async_trait, F, Fut>( &'life0 mut self, k: K, f: F ) -> Pin<Box<dyn Future<Output = &mut V> + Send + 'async_trait>>
Available on crate feature
async
only.