pub struct BroadcastHub<T: Clone + Send + 'static> { /* private fields */ }Expand description
Fan one source to many dynamic consumers.
Implementations§
Source§impl<T: Clone + Send + 'static> BroadcastHub<T>
impl<T: Clone + Send + 'static> BroadcastHub<T>
pub fn new(buffer_size: usize) -> Self
Sourcepub fn attach(&self, source: Source<T>)
pub fn attach(&self, source: Source<T>)
Attach a producer source. Spawns a task that pumps each element into the broadcast channel; returns immediately.
Sourcepub fn consumer(&self) -> Source<T>
pub fn consumer(&self) -> Source<T>
Return a new consumer source. Yields elements broadcast after this call (late subscribers miss earlier elements). Slow subscribers silently skip lagged elements.
Sourcepub fn consumer_count(&self) -> usize
pub fn consumer_count(&self) -> usize
Number of currently-attached consumers.
Auto Trait Implementations§
impl<T> Freeze for BroadcastHub<T>
impl<T> !RefUnwindSafe for BroadcastHub<T>
impl<T> Send for BroadcastHub<T>
impl<T> Sync for BroadcastHub<T>
impl<T> Unpin for BroadcastHub<T>
impl<T> UnsafeUnpin for BroadcastHub<T>
impl<T> !UnwindSafe for BroadcastHub<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more