Function vector::test_util::spawn_collect_ready

source ยท
pub async fn spawn_collect_ready<F, S>(
    future: F,
    stream: S,
    sleep: u64,
) -> Vec<Event>
where F: Future<Output = ()> + Send + 'static, S: Stream<Item = Event> + Unpin,
Expand description

Collect all the ready events from a stream after spawning a future in the background and letting it run for a given interval. This is used for tests where the collect has to happen concurrent with the sending process (ie the stream is handling finalization, which is required for the future to receive an acknowledgement).