Skip to content

Commit 839cee2

Browse files
committed
tests pass again
Signed-off-by: Yoshua Wuyts <yoshuawuyts@gmail.com>
1 parent b4ced4b commit 839cee2

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

src/stream/from_stream.rs

Lines changed: 3 additions & 3 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ cfg_if! {
8787
}
8888
} else {
8989
macro_rules! dyn_ret {
90-
($a:lifetime, $o:ty) => (Pin<Box<dyn core::future::Future<Output = $o> + 'a>>)
90+
($a:lifetime, $o:ty) => (Pin<Box<dyn core::future::Future<Output = $o> + Send + 'a>>)
9191
}
9292
}
9393
}
@@ -482,14 +482,14 @@ pub trait Stream {
482482
///
483483
/// Basic usage:
484484
///
485+
/// ```
485486
/// # fn main() { async_std::task::block_on(async {
486487
/// #
487488
/// use async_std::prelude::*;
488489
/// use async_std::stream;
489490
///
490491
/// let mut s = stream::repeat::<u32>(42).take(3);
491492
/// assert!(s.any(|x| x == 42).await);
492-
///
493493
/// #
494494
/// # }) }
495495
/// ```
@@ -642,7 +642,8 @@ pub trait Stream {
642642
#[must_use = "if you really need to exhaust the iterator, consider `.for_each(drop)` instead (TODO)"]
643643
fn collect<'a, B>(self) -> dyn_ret!('a, B)
644644
where
645-
Self: futures_core::stream::Stream + Sized + 'a,
645+
Self: futures_core::stream::Stream + Sized + Send + 'a,
646+
<Self as futures_core::stream::Stream>::Item: Send,
646647
B: FromStream<<Self as futures_core::stream::Stream>::Item>,
647648
{
648649
FromStream::from_stream(self)

src/vec/from_stream.rs

Lines changed: 3 additions & 3 deletions
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)