Struct kaspa_utils::triggers::Listener
source · pub struct Listener { /* private fields */ }Expand description
A struct used to wait for a trigger event from a Trigger.
Can be waited on synchronously via Listener::wait or asynchronously thanks to the struct
implementing Future.
The listener can be cloned and any amount of threads and tasks can wait for the same trigger at the same time.
Implementations§
source§impl Listener
impl Listener
sourcepub fn wait(&self)
pub fn wait(&self)
Wait for this trigger synchronously.
Blocks the current thread until the corresponding Trigger is triggered.
If the trigger has already been triggered at least once, this returns immediately.
sourcepub fn is_triggered(&self) -> bool
pub fn is_triggered(&self) -> bool
Returns true if this trigger has been triggered.
Trait Implementations§
impl Unpin for Listener
Auto Trait Implementations§
impl RefUnwindSafe for Listener
impl Send for Listener
impl Sync for Listener
impl UnwindSafe for Listener
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
source§impl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
§type IntoFuture = F
type IntoFuture = F
Which kind of future are we turning this into?
source§fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
Creates a future from a value. Read more