Skip to content

Commit 310fd0d

Browse files
authored
impl Clone for stream::{Empty, Pending, Repeat} (#2248)
1 parent e363f18 commit 310fd0d

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

futures-util/src/stream/empty.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,9 @@ impl<T> Stream for Empty<T> {
3838
(0, Some(0))
3939
}
4040
}
41+
42+
impl<T> Clone for Empty<T> {
43+
fn clone(&self) -> Self {
44+
empty()
45+
}
46+
}

futures-util/src/stream/pending.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,9 @@ impl<T> Stream for Pending<T> {
3636
(0, Some(0))
3737
}
3838
}
39+
40+
impl<T> Clone for Pending<T> {
41+
fn clone(&self) -> Self {
42+
pending()
43+
}
44+
}

futures-util/src/stream/repeat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use futures_core::stream::{Stream, FusedStream};
33
use futures_core::task::{Context, Poll};
44

55
/// Stream for the [`repeat`] function.
6-
#[derive(Debug)]
6+
#[derive(Debug, Clone)]
77
#[must_use = "streams do nothing unless polled"]
88
pub struct Repeat<T> {
99
item: T,

0 commit comments

Comments
 (0)