pub struct Broadcast<T: BroadcastTrait> { /* private fields */ }Expand description
Re-exports constants, structs, traits, and types from the broadcast module.
Represents a broadcast mechanism for sending messages to multiple receivers.
This struct encapsulates the core components required for broadcasting, including the capacity of the broadcast channel and the sender responsible for dispatching messages.
Implementations§
Source§impl<T: BroadcastTrait> Broadcast<T>
Implements core functionalities for the Broadcast struct.
impl<T: BroadcastTrait> Broadcast<T>
Implements core functionalities for the Broadcast struct.
Sourcepub fn receiver_count(&self) -> ReceiverCount
pub fn receiver_count(&self) -> ReceiverCount
Retrieves the current number of active receivers subscribed to this broadcast channel.
§Returns
The total count of active receivers.
Sourcepub fn subscribe(&self) -> BroadcastReceiver<T>
pub fn subscribe(&self) -> BroadcastReceiver<T>
Subscribes a new receiver to the broadcast channel.
§Returns
A BroadcastReceiver that can be used to receive messages sent through this broadcast channel.
Sourcepub fn send(&self, data: T) -> BroadcastSendResult<T>
pub fn send(&self, data: T) -> BroadcastSendResult<T>
Trait Implementations§
Source§impl<T: BroadcastTrait> Default for Broadcast<T>
Provides a default implementation for Broadcast instances.
impl<T: BroadcastTrait> Default for Broadcast<T>
Provides a default implementation for Broadcast instances.
The default broadcast channel is initialized with a predefined sender capacity.