pub struct EventMap { /* private fields */ }
Expand description
An event map which allows sending messages to a set of channels
Implementations§
Source§impl EventMap
impl EventMap
Sourcepub fn register_stream<T: Clone + 'static>(&mut self) -> EventStream<T>
pub fn register_stream<T: Clone + 'static>(&mut self) -> EventStream<T>
Register this type with the EventMap, returning a clonable Receiver end
Sourcepub fn register_iter<T: Clone + 'static>(&mut self) -> EventIter<T> ⓘ
pub fn register_iter<T: Clone + 'static>(&mut self) -> EventIter<T> ⓘ
Register this type with the EventMap, returning a clonable Receiver end
Sourcepub fn send<T: Clone + 'static>(&mut self, msg: T) -> bool
pub fn send<T: Clone + 'static>(&mut self, msg: T) -> bool
Send this message to anything listening for it
This will automatically clean up any stale senders after it fails to send
Sourcepub fn active<T: 'static>(&self) -> usize
pub fn active<T: 'static>(&self) -> usize
Get the number of potential listeners for this message
Sourcepub fn is_empty<T: 'static>(&self) -> bool
pub fn is_empty<T: 'static>(&self) -> bool
Determine whether there are any listeners for this message
Sourcepub fn get_senders<T: 'static>(&self) -> Option<Senders<'_, T>>
pub fn get_senders<T: 'static>(&self) -> Option<Senders<'_, T>>
Get an iterator of all senders for this type
The iterator will be over the (Id, Sender<T>)
This returns None if no active senders are available
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EventMap
impl !RefUnwindSafe for EventMap
impl !Send for EventMap
impl !Sync for EventMap
impl Unpin for EventMap
impl !UnwindSafe for EventMap
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