Skip to content

Commit

Permalink
tests pass again
Browse files Browse the repository at this point in the history
Signed-off-by: Yoshua Wuyts <[email protected]>
  • Loading branch information
yoshuawuyts committed Sep 7, 2019
1 parent ecd7f57 commit 7bf3933
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/stream/from_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::pin::Pin;
/// See also: [`IntoStream`].
///
/// [`IntoStream`]: trait.IntoStream.html
pub trait FromStream<T> {
pub trait FromStream<T: Send> {
/// Creates a value from a stream.
///
/// # Examples
Expand All @@ -22,7 +22,7 @@ pub trait FromStream<T> {
///
/// // let _five_fives = async_std::stream::repeat(5).take(5);
/// ```
fn from_stream<'a, S: IntoStream<Item = T> + 'a>(
fn from_stream<'a, S: IntoStream<Item = T> + Send + 'a>(
stream: S,
) -> Pin<Box<dyn core::future::Future<Output = Self> + 'a>>;
) -> Pin<Box<dyn core::future::Future<Output = Self> + Send + 'a>>;
}
6 changes: 3 additions & 3 deletions src/stream/into_stream.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use futures::stream::Stream;
use futures_core::stream::Stream;

/// Conversion into a `Stream`.
///
Expand All @@ -18,13 +18,13 @@ pub trait IntoStream {
type Item;

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

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

impl<I: Stream> IntoStream for I {
impl<I: Stream + Send> IntoStream for I {
type Item = I::Item;
type IntoStream = I;

Expand Down
9 changes: 5 additions & 4 deletions src/stream/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ cfg_if! {
}
} else {
macro_rules! dyn_ret {
($a:lifetime, $o:ty) => (Pin<Box<dyn core::future::Future<Output = $o> + 'a>>)
($a:lifetime, $o:ty) => (Pin<Box<dyn core::future::Future<Output = $o> + Send + 'a>>)
}
}
}
Expand Down Expand Up @@ -243,14 +243,14 @@ pub trait Stream {
///
/// Basic usage:
///
/// ```
/// # fn main() { async_std::task::block_on(async {
/// #
/// use async_std::prelude::*;
/// use async_std::stream;
///
/// let mut s = stream::repeat::<u32>(42).take(3);
/// assert!(s.any(|x| x == 42).await);
///
/// #
/// # }) }
/// ```
Expand Down Expand Up @@ -318,8 +318,9 @@ pub trait Stream {
#[must_use = "if you really need to exhaust the iterator, consider `.for_each(drop)` instead (TODO)"]
fn collect<'a, B>(self) -> dyn_ret!('a, B)
where
Self: futures::stream::Stream + Sized + 'a,
B: FromStream<<Self as futures::stream::Stream>::Item>,
Self: futures_core::stream::Stream + Sized + Send + 'a,
<Self as futures_core::stream::Stream>::Item: Send,
B: FromStream<<Self as futures_core::stream::Stream>::Item>,
{
FromStream::from_stream(self)
}
Expand Down
6 changes: 3 additions & 3 deletions src/vec/from_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ use crate::stream::{FromStream, IntoStream, Stream};

use std::pin::Pin;

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

Expand Down

0 comments on commit 7bf3933

Please sign in to comment.