pub struct BroadcastSlotHandle<M, K>{ /* private fields */ }extractors and reassembler and session only.Expand description
Per-subscriber broadcast handle. Each Clone yields a new
subscriber with its own private queue; every push to the
owning slot fans out to every live subscriber.
§Comparison with super::SlotHandle
| Aspect | SlotHandle | BroadcastSlotHandle |
|---|---|---|
| Clone semantics | Competitive consumer (MPMC) | Broadcast (every clone sees every message) |
| Per-push cost | O(1) atomic | O(subscribers) clones + pushes |
M bound | Send | Send + Clone |
| Memory per subscriber | Shares one queue | One private queue each |
§Drop semantics
Dropping a subscriber removes its queue from the broadcast
set on the next push (best-effort prune via
Weak::upgrade). Slow subscribers’ queues grow until
they’re drained or dropped — bound externally via
Self::drain_n from plan 149.
Implementations§
Source§impl<M, K> BroadcastSlotHandle<M, K>
impl<M, K> BroadcastSlotHandle<M, K>
Sourcepub fn drain(&mut self, out: &mut Vec<SlotMessage<M, K>>) -> usize
pub fn drain(&mut self, out: &mut Vec<SlotMessage<M, K>>) -> usize
Drain every message this subscriber has received since
the last call, into out. Returns the count.
Sourcepub fn drain_n(&mut self, out: &mut Vec<SlotMessage<M, K>>, max: usize) -> usize
pub fn drain_n(&mut self, out: &mut Vec<SlotMessage<M, K>>, max: usize) -> usize
Bounded variant — drain at most max messages.
Sourcepub fn subscribers(&self) -> usize
pub fn subscribers(&self) -> usize
Active subscriber count across the broadcast set (best-effort; read under a lock).
Sourcepub fn parser_kind(&self) -> ParserKind
pub fn parser_kind(&self) -> ParserKind
Parser-kind identity from registration.
Trait Implementations§
Source§impl<M, K> Clone for BroadcastSlotHandle<M, K>
impl<M, K> Clone for BroadcastSlotHandle<M, K>
Source§fn clone(&self) -> Self
fn clone(&self) -> Self
New subscriber: gets its own queue inside the broadcast set. Subsequent pushes go to every live queue. The new subscriber sees only messages pushed AFTER this clone call (no replay of earlier pushes).
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<M, K> Debug for BroadcastSlotHandle<M, K>
impl<M, K> Debug for BroadcastSlotHandle<M, K>
Source§impl<M, K> SlotDrain<M, K> for BroadcastSlotHandle<M, K>
impl<M, K> SlotDrain<M, K> for BroadcastSlotHandle<M, K>
Source§fn drain(&mut self, out: &mut Vec<SlotMessage<M, K>>) -> usize
fn drain(&mut self, out: &mut Vec<SlotMessage<M, K>>) -> usize
out. Returns the
count drained.Source§fn drain_n(&mut self, out: &mut Vec<SlotMessage<M, K>>, max: usize) -> usize
fn drain_n(&mut self, out: &mut Vec<SlotMessage<M, K>>, max: usize) -> usize
max messages into out. Returns the count
drained (<= max).