Macro completion::completion_stream [−][src]
This is supported on crate features
macro
and std
only.A bang macro to generate completion async streams.
These async streams evaluate to a CompletionStream
, and you can .await
CompletionFuture
s 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);