Skip to main content

rememberEventStream

Function rememberEventStream 

Source
pub fn rememberEventStream<T, K, R, S>(key: K, subscribe: S) -> EventStream<T>
where T: Send + 'static, K: PartialEq + 'static, R: 'static, S: FnOnce(EventSender<T>) -> R + 'static,
Expand description

Turns a platform subscription into a composition-scoped EventStream.

subscribe receives a Send EventSender and returns whatever registration handle the service uses; that handle is dropped — unsubscribing the service — when key changes or the composition leaves. This is the one place the framework bridges “a service publishes from another thread” to “a composition collects”.