diff --git a/tokio/src/sync/broadcast.rs b/tokio/src/sync/broadcast.rs index e54fe5c8151..229ba512c5a 100644 --- a/tokio/src/sync/broadcast.rs +++ b/tokio/src/sync/broadcast.rs @@ -758,6 +758,13 @@ impl Receiver { self.len() == 0 } + /// Creates a new [`Receiver`] handle that will receive values sent **after** + /// this call to `subscribe`. + pub fn subscribe(&self) -> Self { + let shared = self.shared.clone(); + new_receiver(shared) + } + /// Locks the next value if there is one. fn recv_ref( &mut self,