pub struct SessionBroadcasts { /* private fields */ }Expand description
Per-session tracker that turns a peer session’s per-broadcast subscription
lifecycle into broadcasts / broadcasts_closed bumps.
Hold one per session (and side). Call Self::subscribe for every
subscription the session opens and keep the returned BroadcastSubscription
alive for that subscription’s lifetime. The guard refcounts subscriptions per
broadcast for this session, so the session’s first subscription to a
broadcast bumps broadcasts and its last to drop bumps broadcasts_closed.
Summed across sessions, broadcasts - broadcasts_closed is the number of
distinct sessions currently subscribed to the broadcast (viewers on the
egress side).
Cheap to clone; clones share the same per-broadcast refcounts (so a single logical session that clones its handle still counts as one).
Implementations§
Source§impl SessionBroadcasts
impl SessionBroadcasts
Sourcepub fn subscribe(&self, path: impl AsPath) -> BroadcastSubscription
pub fn subscribe(&self, path: impl AsPath) -> BroadcastSubscription
Register one active subscription to path for this session. Hold the
returned guard for the subscription’s lifetime; dropping it releases the
subscription (bumping broadcasts_closed when it was the session’s last
for that broadcast).
Trait Implementations§
Source§impl Clone for SessionBroadcasts
impl Clone for SessionBroadcasts
Source§fn clone(&self) -> SessionBroadcasts
fn clone(&self) -> SessionBroadcasts
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more