Skip to content

Commit 9cb2a76

Browse files
first compiling version
1 parent c6836ec commit 9cb2a76

26 files changed

+186
-72
lines changed

Diff for: src/collections/binary_heap/extend.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ use std::pin::Pin;
44
use crate::prelude::*;
55
use crate::stream::{self, IntoStream};
66

7-
impl<T: Ord> stream::Extend<T> for BinaryHeap<T> {
8-
fn extend<'a, S: IntoStream<Item = T> + 'a>(
7+
impl<T: Ord + Send> stream::Extend<T> for BinaryHeap<T> {
8+
fn extend<'a, S: IntoStream<Item = T> + 'a + Send>(
99
&'a mut self,
1010
stream: S,
11-
) -> Pin<Box<dyn Future<Output = ()> + 'a>> {
11+
) -> Pin<Box<dyn Future<Output = ()> + 'a + Send>>
12+
where
13+
<S as IntoStream>::IntoStream: Send,
14+
{
1215
let stream = stream.into_stream();
1316

1417
self.reserve(stream.size_hint().0);

Diff for: src/collections/binary_heap/from_stream.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ impl<T: Ord + Send> FromStream<T> for BinaryHeap<T> {
88
#[inline]
99
fn from_stream<'a, S: IntoStream<Item = T> + 'a>(
1010
stream: S,
11-
) -> Pin<Box<dyn Future<Output = Self> + 'a>> {
11+
) -> Pin<Box<dyn Future<Output = Self> + 'a + Send>>
12+
where
13+
<S as IntoStream>::IntoStream: Send,
14+
{
1215
let stream = stream.into_stream();
1316

1417
Box::pin(async move {

Diff for: src/collections/btree_map/extend.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ use std::pin::Pin;
44
use crate::prelude::*;
55
use crate::stream::{self, IntoStream};
66

7-
impl<K: Ord, V> stream::Extend<(K, V)> for BTreeMap<K, V> {
8-
fn extend<'a, S: IntoStream<Item = (K, V)> + 'a>(
7+
impl<K: Ord + Send, V: Send> stream::Extend<(K, V)> for BTreeMap<K, V> {
8+
fn extend<'a, S: IntoStream<Item = (K, V)> + 'a + Send>(
99
&'a mut self,
1010
stream: S,
11-
) -> Pin<Box<dyn Future<Output = ()> + 'a>> {
11+
) -> Pin<Box<dyn Future<Output = ()> + 'a + Send>>
12+
where
13+
<S as IntoStream>::IntoStream: Send,
14+
{
1215
Box::pin(stream.into_stream().for_each(move |(k, v)| {
1316
self.insert(k, v);
1417
}))

Diff for: src/collections/btree_map/from_stream.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ impl<K: Ord + Send, V: Send> FromStream<(K, V)> for BTreeMap<K, V> {
88
#[inline]
99
fn from_stream<'a, S: IntoStream<Item = (K, V)> + 'a>(
1010
stream: S,
11-
) -> Pin<Box<dyn Future<Output = Self> + 'a>> {
11+
) -> Pin<Box<dyn Future<Output = Self> + 'a + Send>>
12+
where
13+
<S as IntoStream>::IntoStream: Send,
14+
{
1215
let stream = stream.into_stream();
1316

1417
Box::pin(async move {

Diff for: src/collections/btree_set/extend.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ use std::pin::Pin;
44
use crate::prelude::*;
55
use crate::stream::{self, IntoStream};
66

7-
impl<T: Ord> stream::Extend<T> for BTreeSet<T> {
8-
fn extend<'a, S: IntoStream<Item = T> + 'a>(
7+
impl<T: Ord + Send> stream::Extend<T> for BTreeSet<T> {
8+
fn extend<'a, S: IntoStream<Item = T> + 'a + Send>(
99
&'a mut self,
1010
stream: S,
11-
) -> Pin<Box<dyn Future<Output = ()> + 'a>> {
11+
) -> Pin<Box<dyn Future<Output = ()> + 'a + Send>>
12+
where
13+
<S as IntoStream>::IntoStream: Send,
14+
{
1215
Box::pin(stream.into_stream().for_each(move |item| {
1316
self.insert(item);
1417
}))

Diff for: src/collections/btree_set/from_stream.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ impl<T: Ord + Send> FromStream<T> for BTreeSet<T> {
88
#[inline]
99
fn from_stream<'a, S: IntoStream<Item = T> + 'a>(
1010
stream: S,
11-
) -> Pin<Box<dyn Future<Output = Self> + 'a>> {
11+
) -> Pin<Box<dyn Future<Output = Self> + 'a + Send>>
12+
where
13+
<S as IntoStream>::IntoStream: Send,
14+
{
1215
let stream = stream.into_stream();
1316

1417
Box::pin(async move {

Diff for: src/collections/hash_map/extend.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,17 @@ use crate::stream::{self, IntoStream};
77

88
impl<K, V, H> stream::Extend<(K, V)> for HashMap<K, V, H>
99
where
10-
K: Eq + Hash,
11-
H: BuildHasher + Default,
10+
K: Eq + Hash + Send,
11+
V: Send,
12+
H: BuildHasher + Default + Send,
1213
{
13-
fn extend<'a, S: IntoStream<Item = (K, V)> + 'a>(
14+
fn extend<'a, S: IntoStream<Item = (K, V)> + 'a + Send>(
1415
&'a mut self,
1516
stream: S,
16-
) -> Pin<Box<dyn Future<Output = ()> + 'a>> {
17+
) -> Pin<Box<dyn Future<Output = ()> + 'a + Send>>
18+
where
19+
<S as IntoStream>::IntoStream: Send,
20+
{
1721
let stream = stream.into_stream();
1822

1923
// The following is adapted from the hashbrown source code:

Diff for: src/collections/hash_map/from_stream.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@ use crate::stream::{self, FromStream, IntoStream};
88
impl<K, V, H> FromStream<(K, V)> for HashMap<K, V, H>
99
where
1010
K: Eq + Hash + Send,
11-
H: BuildHasher + Default,
11+
H: BuildHasher + Default + Send,
1212
V: Send,
1313
{
1414
#[inline]
1515
fn from_stream<'a, S: IntoStream<Item = (K, V)> + 'a>(
1616
stream: S,
17-
) -> Pin<Box<dyn Future<Output = Self> + 'a>> {
17+
) -> Pin<Box<dyn Future<Output = Self> + 'a + Send>>
18+
where
19+
<S as IntoStream>::IntoStream: Send,
20+
{
1821
let stream = stream.into_stream();
1922

2023
Box::pin(async move {

Diff for: src/collections/hash_set/extend.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@ use crate::stream::{self, IntoStream};
77

88
impl<T, H> stream::Extend<T> for HashSet<T, H>
99
where
10-
T: Eq + Hash,
11-
H: BuildHasher + Default,
10+
T: Eq + Hash + Send,
11+
H: BuildHasher + Default + Send,
1212
{
13-
fn extend<'a, S: IntoStream<Item = T> + 'a>(
13+
fn extend<'a, S: IntoStream<Item = T> + 'a + Send>(
1414
&'a mut self,
1515
stream: S,
16-
) -> Pin<Box<dyn Future<Output = ()> + 'a>> {
16+
) -> Pin<Box<dyn Future<Output = ()> + 'a + Send>>
17+
where
18+
<S as IntoStream>::IntoStream: Send,
19+
{
1720
// The Extend impl for HashSet in the standard library delegates to the internal HashMap.
1821
// Thus, this impl is just a copy of the async Extend impl for HashMap in this crate.
1922

Diff for: src/collections/hash_set/from_stream.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@ use crate::stream::{self, FromStream, IntoStream};
88
impl<T, H> FromStream<T> for HashSet<T, H>
99
where
1010
T: Eq + Hash + Send,
11-
H: BuildHasher + Default,
11+
H: BuildHasher + Default + Send,
1212
{
1313
#[inline]
1414
fn from_stream<'a, S: IntoStream<Item = T> + 'a>(
1515
stream: S,
16-
) -> Pin<Box<dyn Future<Output = Self> + 'a>> {
16+
) -> Pin<Box<dyn Future<Output = Self> + 'a + Send>>
17+
where
18+
<S as IntoStream>::IntoStream: Send,
19+
{
1720
let stream = stream.into_stream();
1821

1922
Box::pin(async move {

Diff for: src/collections/linked_list/extend.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ use std::pin::Pin;
44
use crate::prelude::*;
55
use crate::stream::{self, IntoStream};
66

7-
impl<T> stream::Extend<T> for LinkedList<T> {
8-
fn extend<'a, S: IntoStream<Item = T> + 'a>(
7+
impl<T: Send> stream::Extend<T> for LinkedList<T> {
8+
fn extend<'a, S: IntoStream<Item = T> + 'a + Send>(
99
&'a mut self,
1010
stream: S,
11-
) -> Pin<Box<dyn Future<Output = ()> + 'a>> {
11+
) -> Pin<Box<dyn Future<Output = ()> + 'a + Send>>
12+
where
13+
<S as IntoStream>::IntoStream: Send,
14+
{
1215
let stream = stream.into_stream();
1316
Box::pin(stream.for_each(move |item| self.push_back(item)))
1417
}

Diff for: src/collections/linked_list/from_stream.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ impl<T: Send> FromStream<T> for LinkedList<T> {
88
#[inline]
99
fn from_stream<'a, S: IntoStream<Item = T> + 'a>(
1010
stream: S,
11-
) -> Pin<Box<dyn Future<Output = Self> + 'a>> {
11+
) -> Pin<Box<dyn Future<Output = Self> + 'a + Send>>
12+
where
13+
<S as IntoStream>::IntoStream: Send,
14+
{
1215
let stream = stream.into_stream();
1316

1417
Box::pin(async move {

Diff for: src/collections/vec_deque/extend.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ use std::pin::Pin;
44
use crate::prelude::*;
55
use crate::stream::{self, IntoStream};
66

7-
impl<T> stream::Extend<T> for VecDeque<T> {
8-
fn extend<'a, S: IntoStream<Item = T> + 'a>(
7+
impl<T: Send> stream::Extend<T> for VecDeque<T> {
8+
fn extend<'a, S: IntoStream<Item = T> + 'a + Send>(
99
&'a mut self,
1010
stream: S,
11-
) -> Pin<Box<dyn Future<Output = ()> + 'a>> {
11+
) -> Pin<Box<dyn Future<Output = ()> + 'a + Send>>
12+
where
13+
<S as IntoStream>::IntoStream: Send,
14+
{
1215
let stream = stream.into_stream();
1316

1417
self.reserve(stream.size_hint().0);

Diff for: src/collections/vec_deque/from_stream.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ impl<T: Send> FromStream<T> for VecDeque<T> {
88
#[inline]
99
fn from_stream<'a, S: IntoStream<Item = T> + 'a>(
1010
stream: S,
11-
) -> Pin<Box<dyn Future<Output = Self> + 'a>> {
11+
) -> Pin<Box<dyn Future<Output = Self> + 'a + Send>>
12+
where
13+
<S as IntoStream>::IntoStream: Send,
14+
{
1215
let stream = stream.into_stream();
1316

1417
Box::pin(async move {

Diff for: src/option/from_stream.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ where
1414
#[inline]
1515
fn from_stream<'a, S: IntoStream<Item = Option<T>> + 'a>(
1616
stream: S,
17-
) -> Pin<Box<dyn Future<Output = Self> + 'a>> {
17+
) -> Pin<Box<dyn Future<Output = Self> + 'a + Send>>
18+
where
19+
<S as IntoStream>::IntoStream: Send,
20+
{
1821
let stream = stream.into_stream();
1922

2023
Box::pin(async move {

Diff for: src/path/pathbuf.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,13 @@ impl AsRef<OsStr> for PathBuf {
320320

321321
#[cfg(feature = "unstable")]
322322
impl<P: AsRef<Path>> stream::Extend<P> for PathBuf {
323-
fn extend<'a, S: IntoStream<Item = P> + 'a>(
323+
fn extend<'a, S: IntoStream<Item = P> + 'a + Send>(
324324
&'a mut self,
325325
stream: S,
326-
) -> Pin<Box<dyn Future<Output = ()> + 'a>> {
326+
) -> Pin<Box<dyn Future<Output = ()> + 'a + Send>>
327+
where
328+
<S as IntoStream>::IntoStream: Send,
329+
{
327330
let stream = stream.into_stream();
328331

329332
Box::pin(async move {
@@ -341,7 +344,10 @@ impl<'b, P: AsRef<Path> + 'b + Send> FromStream<P> for PathBuf {
341344
#[inline]
342345
fn from_stream<'a, S: IntoStream<Item = P> + 'a>(
343346
stream: S,
344-
) -> Pin<Box<dyn Future<Output = Self> + 'a>> {
347+
) -> Pin<Box<dyn Future<Output = Self> + 'a + Send>>
348+
where
349+
<S as IntoStream>::IntoStream: Send,
350+
{
345351
let stream = stream.into_stream();
346352

347353
Box::pin(async move {

Diff for: src/result/from_stream.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ where
3232
#[inline]
3333
fn from_stream<'a, S: IntoStream<Item = Result<T, E>> + 'a>(
3434
stream: S,
35-
) -> Pin<Box<dyn Future<Output = Self> + 'a>> {
35+
) -> Pin<Box<dyn Future<Output = Self> + 'a + Send>>
36+
where
37+
<S as IntoStream>::IntoStream: Send,
38+
{
3639
let stream = stream.into_stream();
3740

3841
Box::pin(async move {

Diff for: src/stream/extend.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ use crate::stream::IntoStream;
3131
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
3232
pub trait Extend<A> {
3333
/// Extends a collection with the contents of a stream.
34-
fn extend<'a, T: IntoStream<Item = A> + 'a>(
34+
fn extend<'a, T: IntoStream<Item = A> + 'a + Send>(
3535
&'a mut self,
3636
stream: T,
37-
) -> Pin<Box<dyn Future<Output = ()> + 'a>>;
37+
) -> Pin<Box<dyn Future<Output = ()> + 'a + Send>>
38+
where
39+
<T as IntoStream>::IntoStream: Send;
3840
}
3941

4042
/// Extends a collection with the contents of a stream.
@@ -68,7 +70,8 @@ pub trait Extend<A> {
6870
pub async fn extend<'a, C, T, S>(collection: &mut C, stream: S)
6971
where
7072
C: Extend<T>,
71-
S: IntoStream<Item = T> + 'a,
73+
S: IntoStream<Item = T> + 'a + Send,
74+
<S as IntoStream>::IntoStream: Send,
7275
{
7376
Extend::extend(collection, stream).await
7477
}

Diff for: src/stream/from_stream.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ use crate::stream::IntoStream;
7272
/// impl FromStream<i32> for MyCollection {
7373
/// fn from_stream<'a, S: IntoStream<Item = i32> + 'a>(
7474
/// stream: S,
75-
/// ) -> Pin<Box<dyn Future<Output = Self> + 'a>> {
75+
/// ) -> Pin<Box<dyn Future<Output = Self> + 'a + Send>>
76+
/// where
77+
/// <S as IntoStream>::IntoStream: Send,
78+
/// {
7679
/// let stream = stream.into_stream();
7780
///
7881
/// Box::pin(async move {
@@ -135,5 +138,7 @@ pub trait FromStream<T: Send> {
135138
/// ```
136139
fn from_stream<'a, S: IntoStream<Item = T> + 'a>(
137140
stream: S,
138-
) -> Pin<Box<dyn Future<Output = Self> + 'a>>;
141+
) -> Pin<Box<dyn Future<Output = Self> + 'a + Send>>
142+
where
143+
<S as IntoStream>::IntoStream: Send;
139144
}

Diff for: src/stream/stream/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1888,9 +1888,9 @@ extension_trait! {
18881888
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
18891889
fn collect<'a, B>(
18901890
self,
1891-
) -> impl Future<Output = B> + 'a [Pin<Box<dyn Future<Output = B> + 'a>>]
1891+
) -> impl Future<Output = B> + 'a [Pin<Box<dyn Future<Output = B> + 'a + Send>>]
18921892
where
1893-
Self: Sized + 'a,
1893+
Self: Sized + 'a + Send,
18941894
B: FromStream<Self::Item>,
18951895
Self::Item: Send,
18961896
{

0 commit comments

Comments
 (0)