googleapis / googleapis/google-cloud-rust
Consider offering `try_next() -> Result<Option<T>>` for our stream-like things
Open
type: feature request
- Dominant language
- Rust
- Stars
- 955
- Forks
- 144
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 279
Description
Our stream-like things all have a `next()` (or maybe `poll()`) method which return an `Option>`.
So often example code looks like:
```rs
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`)
```rs
let mut stream = ...;
while let Some(item) = stream.try_next().await? {
println!("item={item:?}");
}
```
Contributor guide
Assessment
This issue has not been assessed yet.