Trait foyer_storage::ForceStorageExt

source ·
pub trait ForceStorageExt<K, V>: Storage<K, V>
where K: StorageKey, V: StorageValue,
{ // Provided methods fn insert_force<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_force_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_force_with_future<AK, AV, 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<V> { ... } }

Provided Methods§

source

fn insert_force<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,

source

fn insert_force_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,

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()

source

fn insert_force_with_future<AK, AV, 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<V>,

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.

§Safety

weight MUST be equal to key.serialized_len() + value.serialized_len()

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<K, V, S> ForceStorageExt<K, V> for S
where K: StorageKey, V: StorageValue, S: Storage<K, V>,