pub struct Signal { /* private fields */ }
Expand description
A Signal
represents listens for a pulse
to occur in the system. A
Signal
has one of three states. Pending, Pulsed, or Errored. Pending
means the pulse has not fired, but still exists. Pulsed meaning the
pulse has fired, and no longer exists. Errored means the pulse was dropped
without firing. This normally means a programming error of some sort.
Implementations§
Source§impl Signal
impl Signal
Sourcepub fn state(&self) -> SignalState
pub fn state(&self) -> SignalState
Read out the state of the Signal
Sourcepub fn is_pending(&self) -> bool
pub fn is_pending(&self) -> bool
Check to see if the signal is pending. A signal
Sourcepub fn id(&self) -> usize
pub fn id(&self) -> usize
This is a unique id that can be used to identify the signal from others
See Select
for how this api is useful.
Sourcepub fn wait(self) -> Result<(), WaitError>
pub fn wait(self) -> Result<(), WaitError>
Block the current thread until a pulse
is ready.
This will block indefinably if the pulse never fires.
Sourcepub fn wait_timeout_ms(self, ms: u32) -> Result<(), TimeoutError>
pub fn wait_timeout_ms(self, ms: u32) -> Result<(), TimeoutError>
Block until either the pulse is sent, or the timeout is reached
pub fn callback<F>(self, cb: F)where
F: FnOnce() + 'static,
Trait Implementations§
impl Send for Signal
impl Sync for Signal
Auto Trait Implementations§
impl Freeze for Signal
impl !RefUnwindSafe for Signal
impl Unpin for Signal
impl !UnwindSafe for Signal
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