use ergonomic try_next() combinator instead of transpose()
This commit is contained in:
parent
5a6d1e764d
commit
d585ad7b31
2 changed files with 3 additions and 3 deletions
|
@ -57,7 +57,7 @@ pub async fn run(args: &ArgMatches) -> Result<(), WebmetroError> {
|
||||||
|
|
||||||
let response = client.request(request).await?;
|
let response = client.request(request).await?;
|
||||||
let mut response_stream = response.into_body();
|
let mut response_stream = response.into_body();
|
||||||
while let Some(response_chunk) = response_stream.next().await.transpose()? {
|
while let Some(response_chunk) = response_stream.try_next().await? {
|
||||||
stdout().write_all(&response_chunk)?;
|
stdout().write_all(&response_chunk)?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use bytes::{Buf, BufMut, Bytes, BytesMut};
|
use bytes::{Buf, BufMut, Bytes, BytesMut};
|
||||||
use futures::stream::{Stream, StreamExt};
|
use futures::{TryStreamExt, stream::{Stream, StreamExt}};
|
||||||
use std::task::{Context, Poll};
|
use std::task::{Context, Poll};
|
||||||
|
|
||||||
use crate::ebml::FromEbml;
|
use crate::ebml::FromEbml;
|
||||||
|
@ -93,7 +93,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
match self.stream.next().await.transpose()? {
|
match self.stream.try_next().await? {
|
||||||
Some(refill) => {
|
Some(refill) => {
|
||||||
self.buffer.reserve(refill.remaining());
|
self.buffer.reserve(refill.remaining());
|
||||||
self.buffer.put(refill);
|
self.buffer.put(refill);
|
||||||
|
|
Loading…
Reference in a new issue