[][src]Macro tari_test_utils::collect_stream_count

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

Returns a HashMap of the number of occurrences of a particular item in a stream.


let mut rt = Runtime::new().unwrap();
let mut stream = stream::iter(vec![1,2,2,3,2]);
assert_eq!(rt.block_on(async { collect_stream_count!(stream, timeout=Duration::from_secs(1)) }).get(&2), Some(&3));