macro_rules! stream_yield { ($e:expr) => { ... }; }
Expand description
Yield an item from an #[async_stream]
function.
§Examples
ⓘ
#![feature(proc_macro, generators, pin)]
extern crate futures;
use futures::prelude::*;
use futures::stream;
use futures::executor::block_on;
#[async_stream(item = u32)]
fn one_five() -> Result<(), u32> {
stream_yield!(1);
stream_yield!(5);
Ok(())
}
assert_eq!(Ok(vec![1, 5]), block_on(one_five().pin().collect()));