pub struct Trigger { /* private fields */ }
Expand description
re-exports triggered crate as well as
two wrappers SingleTrigger and ReqRespTrigger
A struct used to trigger Listener
s it is paired with.
Can be cloned to create multiple instances that all trigger the same listeners.
Implementations§
Source§impl Trigger
impl Trigger
Sourcepub fn trigger(&self)
pub fn trigger(&self)
Trigger all Listener
s paired with this trigger.
Makes all listeners currently blocked in Listener::wait
return,
and all that is being await
ed finish.
Calling this method only does anything the first time. Any subsequent trigger call to the same instance or a clone thereof does nothing, it has already been triggered. Any listener waiting on the trigger after it has been triggered will just return instantly.
This method is safe to call from both async and sync code. It’s not an async function, but it always finishes very fast.
Sourcepub fn is_triggered(&self) -> bool
pub fn is_triggered(&self) -> bool
Returns true if this trigger has been triggered.