Skip to content

Commit

Permalink
add Clone trait to WeakAddr (actix#385)
Browse files Browse the repository at this point in the history
Co-authored-by: Rob Ede <[email protected]>
  • Loading branch information
zyctree and robjtede authored May 14, 2020
1 parent 2921e79 commit 2f3b109
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/address/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ pub struct WeakAddressSender<A: Actor> {
inner: Weak<Inner<A>>,
}

impl<A: Actor> Clone for WeakAddressSender<A> {
fn clone(&self) -> WeakAddressSender<A> {
WeakAddressSender {
inner: self.inner.clone(),
}
}
}

impl<A: Actor> fmt::Debug for WeakAddressSender<A> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("WeakAddressSender").finish()
Expand Down
8 changes: 8 additions & 0 deletions src/address/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,14 @@ impl<A: Actor> WeakAddr<A> {
}
}

impl<A: Actor> Clone for WeakAddr<A> {
fn clone(&self) -> WeakAddr<A> {
WeakAddr {
wtx: self.wtx.clone(),
}
}
}

/// The `Recipient` type allows to send one specific message to an
/// actor.
///
Expand Down

0 comments on commit 2f3b109

Please sign in to comment.