Skip to content

Commit 6ee3f6c

Browse files
committed
tests pass again
Signed-off-by: Yoshua Wuyts <[email protected]>
1 parent 6c4c958 commit 6ee3f6c

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
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

+2-2
Original file line numberDiff line numberDiff line change
@@ -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/mod.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ cfg_if! {
9191
}
9292
} else {
9393
macro_rules! dyn_ret {
94-
($a:lifetime, $o:ty) => (Pin<Box<dyn core::future::Future<Output = $o> + 'a>>)
94+
($a:lifetime, $o:ty) => (Pin<Box<dyn core::future::Future<Output = $o> + Send + 'a>>)
9595
}
9696
}
9797
}
@@ -544,14 +544,14 @@ pub trait Stream {
544544
///
545545
/// Basic usage:
546546
///
547+
/// ```
547548
/// # fn main() { async_std::task::block_on(async {
548549
/// #
549550
/// use async_std::prelude::*;
550551
/// use async_std::stream;
551552
///
552553
/// let mut s = stream::repeat::<u32>(42).take(3);
553554
/// assert!(s.any(|x| x == 42).await);
554-
///
555555
/// #
556556
/// # }) }
557557
/// ```
@@ -704,7 +704,8 @@ pub trait Stream {
704704
#[must_use = "if you really need to exhaust the iterator, consider `.for_each(drop)` instead (TODO)"]
705705
fn collect<'a, B>(self) -> dyn_ret!('a, B)
706706
where
707-
Self: futures_core::stream::Stream + Sized + 'a,
707+
Self: futures_core::stream::Stream + Sized + Send + 'a,
708+
<Self as futures_core::stream::Stream>::Item: Send,
708709
B: FromStream<<Self as futures_core::stream::Stream>::Item>,
709710
{
710711
FromStream::from_stream(self)

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)