pub struct CommBus<'a> { /* private fields */ }
Implementations§
source§impl<'a> CommBus<'a>
impl<'a> CommBus<'a>
sourcepub fn register(
&mut self,
event_name: &str,
callback: impl FnMut(&str) + 'a
) -> Option<Rc<RefCell<Option<CommBusEvent<'a>>>>>
pub fn register( &mut self, event_name: &str, callback: impl FnMut(&str) + 'a ) -> Option<Rc<RefCell<Option<CommBusEvent<'a>>>>>
Registers to a communication event.
Returns the event if the registration was successful.
By calling take
on the returned value the event gets unregistered.
sourcepub fn call(event_name: &str, args: &str, called: CommBusBroadcastFlags) -> bool
pub fn call(event_name: &str, args: &str, called: CommBusBroadcastFlags) -> bool
Calls a communication event.
Returns true
if the call was successful.
sourcepub fn unregister_all(&mut self)
pub fn unregister_all(&mut self)
Deregisters all communication events registered with this CommBus
instance.
The same functionality can be achieved by dropping the CommBus
instance and creating a new instance.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for CommBus<'a>
impl<'a> !Send for CommBus<'a>
impl<'a> !Sync for CommBus<'a>
impl<'a> Unpin for CommBus<'a>
impl<'a> !UnwindSafe for CommBus<'a>
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