[][src]Macro tari_test_utils::collect_stream

macro_rules! collect_stream {
    ($runtime:expr, $stream:expr, take=$take:expr, timeout=$timeout:expr $(,)?) => { ... };
    ($runtime:expr, $stream:expr, timeout=$timeout:expr $(,)?) => { ... };
}

Collect $take items from a stream or timeout for Duration $timeout. Requires the tokio runtime

This code runs with edition 2018

let mut rt = Runtime::new().unwrap();
let stream = stream::iter(1..10);
assert_eq!(collect_stream!(rt, stream, take=3, timeout=Duration::from_secs(1)), vec![1,2,3]);