macro_rules! completion_stream {
($($tt:tt)*) => { ... };
}Available on crate features
macro and std only.Expand description
A bang macro to generate completion async streams.
These async streams evaluate to a CompletionStream, and you can .await
CompletionFutures inside of them. You can return values using a yield expression. The ?
operator works in the stream if it yields an Option or Result - if an error occurs the
stream will yield that single error and then exit.
ยงExamples
use completion::{completion_stream, CompletionStreamExt};
let stream = completion_stream! {
for i in 0..3 {
yield i;
}
};
pin!(stream);
assert_eq!(stream.next().await, Some(0));
assert_eq!(stream.next().await, Some(1));
assert_eq!(stream.next().await, Some(2));
assert_eq!(stream.next().await, None);