Function spawn_listener

Source
pub fn spawn_listener<T, F, S, I, E>(
    handle: GenServerHandle<T>,
    message_builder: F,
    stream: S,
) -> JoinHandle<()>
where T: GenServer + 'static, F: Fn(I) -> T::CastMsg + Send + 'static + Sync, I: Send, E: Debug + Send, S: Unpin + Send + Stream<Item = Result<I, E>> + 'static,
Expand description

Spawns a listener that listens to a stream and sends messages to a GenServer.

Items sent through the stream are required to be wrapped in a Result type.

This function returns a handle to the spawned task and a cancellation token to stop it.