Trait foyer_storage::StorageExt
source · pub trait StorageExt<K, V>: Storage<K, V>where
K: StorageKey,
V: StorageValue,{
// Provided methods
fn insert<AK, AV>(
&self,
key: AK,
value: AV
) -> impl Future<Output = Result<Option<CachedEntry<K, V>>>> + Send
where AK: Into<Arc<K>> + Send + 'static,
AV: Into<Arc<V>> + Send + 'static { ... }
fn insert_if_not_exists<AK, AV>(
&self,
key: AK,
value: AV
) -> impl Future<Output = Result<bool>> + Send
where AK: Into<Arc<K>> + Send + 'static,
AV: Into<Arc<V>> + Send + 'static { ... }
fn insert_with<AK, AV, F>(
&self,
key: AK,
f: F
) -> impl Future<Output = Result<Option<CachedEntry<K, V>>>> + Send
where AK: Into<Arc<K>> + Send + 'static,
AV: Into<Arc<V>> + Send + 'static,
F: FnOnce() -> Result<AV> + Send { ... }
fn insert_with_future<AV, AK, F, FU>(
&self,
key: AK,
f: F
) -> impl Future<Output = Result<Option<CachedEntry<K, V>>>> + Send
where AK: Into<Arc<K>> + Send + 'static,
AV: Into<Arc<V>> + Send + 'static,
F: FnOnce() -> FU + Send,
FU: FetchValueFuture<AV> { ... }
fn insert_if_not_exists_with<AV, AK, F>(
&self,
key: AK,
f: F
) -> impl Future<Output = Result<bool>> + Send
where AK: Into<Arc<K>> + Send + 'static,
AV: Into<Arc<V>> + Send + 'static,
F: FnOnce() -> Result<AV> + Send { ... }
fn insert_if_not_exists_with_future<AK, AV, F, FU>(
&self,
key: AK,
f: F
) -> impl Future<Output = Result<bool>> + Send
where AK: Into<Arc<K>> + Send + 'static,
AV: Into<Arc<V>> + Send + 'static,
F: FnOnce() -> FU + Send,
FU: FetchValueFuture<AV> { ... }
}
Provided Methods§
fn insert<AK, AV>( &self, key: AK, value: AV ) -> impl Future<Output = Result<Option<CachedEntry<K, V>>>> + Send
fn insert_if_not_exists<AK, AV>( &self, key: AK, value: AV ) -> impl Future<Output = Result<bool>> + Send
sourcefn insert_with<AK, AV, F>(
&self,
key: AK,
f: F
) -> impl Future<Output = Result<Option<CachedEntry<K, V>>>> + Send
fn insert_with<AK, AV, F>( &self, key: AK, f: F ) -> impl Future<Output = Result<Option<CachedEntry<K, V>>>> + Send
First judge if the entry will be admitted with key
and weight
by admission policies.
Then f
will be called and entry will be inserted.
§Safety
weight
MUST be equal to key.serialized_len() + value.serialized_len()
sourcefn insert_with_future<AV, AK, F, FU>(
&self,
key: AK,
f: F
) -> impl Future<Output = Result<Option<CachedEntry<K, V>>>> + Send
fn insert_with_future<AV, AK, F, FU>( &self, key: AK, f: F ) -> impl Future<Output = Result<Option<CachedEntry<K, V>>>> + Send
First judge if the entry will be admitted with key
and weight
by admission policies.
Then f
will be called to fetch value, and entry will be inserted.
fn insert_if_not_exists_with<AV, AK, F>( &self, key: AK, f: F ) -> impl Future<Output = Result<bool>> + Send
fn insert_if_not_exists_with_future<AK, AV, F, FU>( &self, key: AK, f: F ) -> impl Future<Output = Result<bool>> + Send
Object Safety§
This trait is not object safe.