pub trait UseStateConvTarget<S, T, Tag>: HasStateHandle<S, T, Tag>where
Self: 'static,
S: 'static + Clone + Debug + Send,
T: 'static + Clone + Debug + PartialEq + Send + Sync,
Tag: 'static + Clone + Debug + Eq + Hash + Send + Sync,{
// Provided method
fn convert_subscribe<'async_trait>(
self: Arc<Self>,
reader: Reader<S>,
tag: Tag,
convert: impl 'async_trait + Fn(S) -> Pin<Box<dyn Future<Output = T> + Send>> + Send + 'static,
) -> Pin<Box<dyn Future<Output = Handle<T>> + Send + 'async_trait>>
where 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 convert_subscribe<'async_trait>(
self: Arc<Self>,
reader: Reader<S>,
tag: Tag,
convert: impl 'async_trait + Fn(S) -> Pin<Box<dyn Future<Output = T> + Send>> + Send + 'static,
) -> Pin<Box<dyn Future<Output = Handle<T>> + Send + 'async_trait>>
fn convert_subscribe<'async_trait>( self: Arc<Self>, reader: Reader<S>, tag: Tag, convert: impl 'async_trait + Fn(S) -> Pin<Box<dyn Future<Output = T> + Send>> + Send + 'static, ) -> Pin<Box<dyn Future<Output = Handle<T>> + Send + 'async_trait>>
Do subscription with a state convert function.
- stage [1] – receive from source’s broadcast channel.
- stage [2] – convert to target type and send to mpsc channel.
- stage [3] – receive from mpsc 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".