pub struct Broadcast<T: Clone>(/* private fields */);Expand description
Represents a source of data which notifies listeners on a new value.
Implementations§
Source§impl<T: Clone> Broadcast<T>
impl<T: Clone> Broadcast<T>
Sourcepub fn new(data: T) -> Self
pub fn new(data: T) -> Self
Creates a new broadcast event with the associated initial value. Panics
on failure; see Broadcast::try_new().
Sourcepub fn try_new(data: T) -> Result<Self, Error>
pub fn try_new(data: T) -> Result<Self, Error>
Creates a new broadcast event with the associated initial value.
Sourcepub fn listen(&self) -> BroadcastListener<T>
pub fn listen(&self) -> BroadcastListener<T>
Creates a new listener for the broadcast event.
Auto Trait Implementations§
impl<T> Freeze for Broadcast<T>
impl<T> !RefUnwindSafe for Broadcast<T>
impl<T> Send for Broadcast<T>
impl<T> Sync for Broadcast<T>
impl<T> Unpin for Broadcast<T>
impl<T> !UnwindSafe for Broadcast<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