Skip to content

Commit 7bf3933

Browse files
committed
tests pass again
Signed-off-by: Yoshua Wuyts <[email protected]>
1 parent ecd7f57 commit 7bf3933

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

src/stream/from_stream.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::pin::Pin;
1010
/// See also: [`IntoStream`].
1111
///
1212
/// [`IntoStream`]: trait.IntoStream.html
13-
pub trait FromStream<T> {
13+
pub trait FromStream<T: Send> {
1414
/// Creates a value from a stream.
1515
///
1616
/// # Examples
@@ -22,7 +22,7 @@ pub trait FromStream<T> {
2222
///
2323
/// // let _five_fives = async_std::stream::repeat(5).take(5);
2424
/// ```
25-
fn from_stream<'a, S: IntoStream<Item = T> + 'a>(
25+
fn from_stream<'a, S: IntoStream<Item = T> + Send + 'a>(
2626
stream: S,
27-
) -> Pin<Box<dyn core::future::Future<Output = Self> + 'a>>;
27+
) -> Pin<Box<dyn core::future::Future<Output = Self> + Send + 'a>>;
2828
}

src/stream/into_stream.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use futures::stream::Stream;
1+
use futures_core::stream::Stream;
22

33
/// Conversion into a `Stream`.
44
///
@@ -18,13 +18,13 @@ pub trait IntoStream {
1818
type Item;
1919

2020
/// Which kind of stream are we turning this into?
21-
type IntoStream: Stream<Item = Self::Item>;
21+
type IntoStream: Stream<Item = Self::Item> + Send;
2222

2323
/// Creates a stream from a value.
2424
fn into_stream(self) -> Self::IntoStream;
2525
}
2626

27-
impl<I: Stream> IntoStream for I {
27+
impl<I: Stream + Send> IntoStream for I {
2828
type Item = I::Item;
2929
type IntoStream = I;
3030

src/stream/stream.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ cfg_if! {
6262
}
6363
} else {
6464
macro_rules! dyn_ret {
65-
($a:lifetime, $o:ty) => (Pin<Box<dyn core::future::Future<Output = $o> + 'a>>)
65+
($a:lifetime, $o:ty) => (Pin<Box<dyn core::future::Future<Output = $o> + Send + 'a>>)
6666
}
6767
}
6868
}
@@ -243,14 +243,14 @@ pub trait Stream {
243243
///
244244
/// Basic usage:
245245
///
246+
/// ```
246247
/// # fn main() { async_std::task::block_on(async {
247248
/// #
248249
/// use async_std::prelude::*;
249250
/// use async_std::stream;
250251
///
251252
/// let mut s = stream::repeat::<u32>(42).take(3);
252253
/// assert!(s.any(|x| x == 42).await);
253-
///
254254
/// #
255255
/// # }) }
256256
/// ```
@@ -318,8 +318,9 @@ pub trait Stream {
318318
#[must_use = "if you really need to exhaust the iterator, consider `.for_each(drop)` instead (TODO)"]
319319
fn collect<'a, B>(self) -> dyn_ret!('a, B)
320320
where
321-
Self: futures::stream::Stream + Sized + 'a,
322-
B: FromStream<<Self as futures::stream::Stream>::Item>,
321+
Self: futures_core::stream::Stream + Sized + Send + 'a,
322+
<Self as futures_core::stream::Stream>::Item: Send,
323+
B: FromStream<<Self as futures_core::stream::Stream>::Item>,
323324
{
324325
FromStream::from_stream(self)
325326
}

src/vec/from_stream.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ use crate::stream::{FromStream, IntoStream, Stream};
22

33
use std::pin::Pin;
44

5-
impl<T> FromStream<T> for Vec<T> {
5+
impl<T: Send> FromStream<T> for Vec<T> {
66
#[inline]
77
fn from_stream<'a, S: IntoStream<Item = T>>(
88
stream: S,
9-
) -> Pin<Box<dyn core::future::Future<Output = Self> + 'a>>
9+
) -> Pin<Box<dyn core::future::Future<Output = Self> + Send + 'a>>
1010
where
11-
<S as IntoStream>::IntoStream: 'a,
11+
<S as IntoStream>::IntoStream: Send + 'a,
1212
{
1313
let stream = stream.into_stream();
1414

0 commit comments

Comments
 (0)