pub struct Signal { /* private fields */ }Expand description
Cancellation, like an AbortSignal: aborted once, with a reason. A call’s signal cancels it; the signal a
HostHandler receives is aborted when its cell completes or fails.
Implementations§
Source§impl Signal
impl Signal
pub fn new() -> Self
pub fn reason(&self) -> Option<String>
pub fn is_aborted(&self) -> bool
Sourcepub fn wait(&self, timeout: Duration) -> bool
pub fn wait(&self, timeout: Duration) -> bool
Blocks until aborted or timeout passes; whether it is aborted.
Sourcepub fn on_abort(
&self,
listener: impl FnOnce(String) + Send + 'static,
) -> Option<u64>
pub fn on_abort( &self, listener: impl FnOnce(String) + Send + 'static, ) -> Option<u64>
Runs listener once, on abort (on the aborting thread); None (and listener is dropped) when already
aborted. Signal::forget removes it.
pub fn forget(&self, id: u64)
Trait Implementations§
Auto Trait Implementations§
impl Forget for Signal
impl Freeze for Signal
impl Move for Signal
impl RefUnwindSafe for Signal
impl Send for Signal
impl Sync for Signal
impl Unpin for Signal
impl UnsafeUnpin 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