Using Box::pin(...) instead of Pin::from(Box::new(...))

This commit is contained in:
Sunjay Varma 2019-09-28 22:16:12 -04:00
parent ab7129cd45
commit fb7582bd7a
3 changed files with 6 additions and 6 deletions

View file

@ -19,7 +19,7 @@ where
{
let stream = stream.into_stream();
Pin::from(Box::new(async move {
Box::pin(async move {
pin_utils::pin_mut!(stream);
// Using `scan` here because it is able to stop the stream early
@ -44,6 +44,6 @@ where
} else {
Some(out)
}
}))
})
}
}

View file

@ -19,7 +19,7 @@ where
{
let stream = stream.into_stream();
Pin::from(Box::new(async move {
Box::pin(async move {
pin_utils::pin_mut!(stream);
// Using `scan` here because it is able to stop the stream early
@ -43,6 +43,6 @@ where
Some(err) => Err(err),
None => Ok(out),
}
}))
})
}
}

View file

@ -12,12 +12,12 @@ impl<T> FromStream<T> for Vec<T> {
{
let stream = stream.into_stream();
Pin::from(Box::new(async move {
Box::pin(async move {
pin_utils::pin_mut!(stream);
let mut out = vec![];
out.stream_extend(stream).await;
out
}))
})
}
}