[−][src]Macro tari_test_utils::collect_stream
Collect $take items from a stream or timeout for Duration $timeout.
Requires the tokio
runtime and should be used in an async context.
ⓘ
let mut rt = Runtime::new().unwrap(); let mut stream = stream::iter(1..10); assert_eq!(rt.block_on(async { collect_stream!(stream, take=3, timeout=Duration::from_secs(1)) }), vec![1,2,3]);