Skip to content

Commit c77cd3c

Browse files
Harry Barbertaiki-e
Harry Barber
authored andcommitted
Add Clone to WeakShared
1 parent 605b77c commit c77cd3c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

futures-util/src/future/future/shared.rs

+6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ struct Notifier {
2929
/// A weak reference to a [`Shared`] that can be upgraded much like an `Arc`.
3030
pub struct WeakShared<Fut: Future>(Weak<Inner<Fut>>);
3131

32+
impl<Fut: Future> Clone for WeakShared<Fut> {
33+
fn clone(&self) -> Self {
34+
Self(self.0.clone())
35+
}
36+
}
37+
3238
// The future itself is polled behind the `Arc`, so it won't be moved
3339
// when `Shared` is moved.
3440
impl<Fut: Future> Unpin for Shared<Fut> {}

0 commit comments

Comments
 (0)