mirror of
https://github.com/async-rs/async-std.git
synced 2025-04-11 10:56:44 +00:00
FromStream for Vec<T> in terms of Extend
This commit is contained in:
parent
76b10c4784
commit
ab7129cd45
1 changed files with 2 additions and 5 deletions
|
@ -1,7 +1,6 @@
|
|||
use std::pin::Pin;
|
||||
|
||||
use crate::prelude::*;
|
||||
use crate::stream::{FromStream, IntoStream};
|
||||
use crate::stream::{FromStream, IntoStream, Extend};
|
||||
|
||||
impl<T> FromStream<T> for Vec<T> {
|
||||
#[inline]
|
||||
|
@ -17,9 +16,7 @@ impl<T> FromStream<T> for Vec<T> {
|
|||
pin_utils::pin_mut!(stream);
|
||||
|
||||
let mut out = vec![];
|
||||
while let Some(item) = stream.next().await {
|
||||
out.push(item);
|
||||
}
|
||||
out.stream_extend(stream).await;
|
||||
out
|
||||
}))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue