Skip to content

Commit

Permalink
Add Clone to WeakShared
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry Barber authored and taiki-e committed Apr 17, 2021
1 parent 605b77c commit c77cd3c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions futures-util/src/future/future/shared.rs
Expand Up @@ -29,6 +29,12 @@ struct Notifier {
/// A weak reference to a [`Shared`] that can be upgraded much like an `Arc`.
pub struct WeakShared<Fut: Future>(Weak<Inner<Fut>>);

impl<Fut: Future> Clone for WeakShared<Fut> {
fn clone(&self) -> Self {
Self(self.0.clone())
}
}

// The future itself is polled behind the `Arc`, so it won't be moved
// when `Shared` is moved.
impl<Fut: Future> Unpin for Shared<Fut> {}
Expand Down

0 comments on commit c77cd3c

Please sign in to comment.