pub trait UseStateHandle<T, G>: HasStateHandle<T, G> + 'staticwhere
T: 'static + Clone + Debug + PartialEq + Send + Sync,
G: 'static + Clone + Debug + Eq + Hash + Send + Sync,{
// Provided method
fn subscribe<'async_trait, S>(
self: Arc<Self>,
reader: impl 'async_trait + Into<ReaderEx<S, T>> + Send,
tag: G,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where S: 'static + Clone + Debug + PartialEq + Send + Sync + 'async_trait,
Self: Sync + Send + 'async_trait { ... }
}Expand description
Convenient method to do subscription with a state convert function. The trait is auto implemented for types implemented HasStateHandle.
Provided Methods§
Sourcefn subscribe<'async_trait, S>(
self: Arc<Self>,
reader: impl 'async_trait + Into<ReaderEx<S, T>> + Send,
tag: G,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
fn subscribe<'async_trait, S>( self: Arc<Self>, reader: impl 'async_trait + Into<ReaderEx<S, T>> + Send, tag: G, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
Do subscription with a state convert function.
- stage [1] – receive from source’s broadcast channel.
- stage [3] – receive from source’s broadcast channel and process it.
- stage [4] – (optional) feedback when the change event has been processed.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".