pub struct Interrupt { /* private fields */ }Expand description
A deadline and/or a cancel flag. Interrupt::default() never triggers.
Implementations§
Source§impl Interrupt
impl Interrupt
Sourcepub fn with_flag(self, flag: Arc<AtomicBool>) -> Self
pub fn with_flag(self, flag: Arc<AtomicBool>) -> Self
Also trigger when flag is set (from any thread).
Sourcepub fn with_deadline(self, deadline: Instant) -> Self
pub fn with_deadline(self, deadline: Instant) -> Self
Also trigger at deadline (replacing any earlier deadline).
Sourcepub fn deadline_passed(&self) -> bool
pub fn deadline_passed(&self) -> bool
True when a deadline is set and has passed. Lets a host that set both a deadline and a flag tell which one fired.
Sourcepub fn is_triggered(&self) -> bool
pub fn is_triggered(&self) -> bool
True when either the deadline has passed or the flag is set.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Interrupt
impl RefUnwindSafe for Interrupt
impl Send for Interrupt
impl Sync for Interrupt
impl Unpin for Interrupt
impl UnsafeUnpin for Interrupt
impl UnwindSafe for Interrupt
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