pub trait StateAsyncGetMutOrInsert: State {
// Required method
fn get_mut_or_insert_with<T>(
&self,
get_data: impl FnOnce() -> T + Send,
) -> impl Future<Output = impl DerefMut> + Send
where T: 'static + Send + Sync;
// Provided methods
fn get_mut_or_insert<T>(
&self,
data: T,
) -> impl Future<Output = impl DerefMut> + Send
where T: 'static + Send + Sync { ... }
fn get_mut_or_insert_default<T>(
&self,
) -> impl Future<Output = impl DerefMut> + Send
where T: 'static + Send + Sync + Default { ... }
}Expand description
Get data mutably or insert (async immutable version)
Required Methods§
Provided Methods§
Sourcefn get_mut_or_insert<T>(
&self,
data: T,
) -> impl Future<Output = impl DerefMut> + Send
fn get_mut_or_insert<T>( &self, data: T, ) -> impl Future<Output = impl DerefMut> + Send
Returns data of type T mutably, inserts if not found
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.