Our stream-like things all have a next() (or maybe poll()) method which return an Option<Result<T>>.
So often example code looks like:
let mut stream = ...;
while let Some(item) = stream.next().await.transpose()? {
println!("item={item:?}");
}
To slightly improve application ergonomics, we could consider offering a try_next() for our streams as a shorthand for omitting the transpose() (akin to futures::TryStreamExt)
let mut stream = ...;
while let Some(item) = stream.try_next().await? {
println!("item={item:?}");
}
Our stream-like things all have a
next()(or maybepoll()) method which return anOption<Result<T>>.So often example code looks like:
To slightly improve application ergonomics, we could consider offering a
try_next()for our streams as a shorthand for omitting thetranspose()(akin tofutures::TryStreamExt)