Skip to content

Commit 838e1ee

Browse files
committed
tests pass again
Signed-off-by: Yoshua Wuyts <[email protected]>
1 parent 4c94db3 commit 838e1ee

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
@@ -81,7 +81,7 @@ cfg_if! {
8181
}
8282
} else {
8383
macro_rules! dyn_ret {
84-
($a:lifetime, $o:ty) => (Pin<Box<dyn core::future::Future<Output = $o> + 'a>>)
84+
($a:lifetime, $o:ty) => (Pin<Box<dyn core::future::Future<Output = $o> + Send + 'a>>)
8585
}
8686
}
8787
}
@@ -380,14 +380,14 @@ pub trait Stream {
380380
///
381381
/// Basic usage:
382382
///
383+
/// ```
383384
/// # fn main() { async_std::task::block_on(async {
384385
/// #
385386
/// use async_std::prelude::*;
386387
/// use async_std::stream;
387388
///
388389
/// let mut s = stream::repeat::<u32>(42).take(3);
389390
/// assert!(s.any(|x| x == 42).await);
390-
///
391391
/// #
392392
/// # }) }
393393
/// ```
@@ -455,7 +455,8 @@ pub trait Stream {
455455
#[must_use = "if you really need to exhaust the iterator, consider `.for_each(drop)` instead (TODO)"]
456456
fn collect<'a, B>(self) -> dyn_ret!('a, B)
457457
where
458-
Self: futures_core::stream::Stream + Sized + 'a,
458+
Self: futures_core::stream::Stream + Sized + Send + 'a,
459+
<Self as futures_core::stream::Stream>::Item: Send,
459460
B: FromStream<<Self as futures_core::stream::Stream>::Item>,
460461
{
461462
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)