forked from mirror/async-std
Using Box::pin(...) instead of Pin::from(Box::new(...))
This commit is contained in:
parent
ab7129cd45
commit
fb7582bd7a
3 changed files with 6 additions and 6 deletions
|
@ -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)
|
||||
}
|
||||
}))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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),
|
||||
}
|
||||
}))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue