Macro async_for::async_for [−][src]
async_for!() { /* proc-macro */ }
Expand description
This macro can let you use async Stream with for loop like Iterator.
Example
use async_for::async_for; use futures_util::{stream, StreamExt}; futures_executor::block_on(async { let mut result = vec![]; async_for! { async for n in stream::iter(vec![1, 2, 3]) { result.push(n); } } assert_eq!(result, vec![1, 2, 3]); })