pub struct Signal { /* private fields */ }Expand description
Cloneable handle onto a scope’s cancellation level. See the module docs for the level/merge model.
The level list is a shared slice, not an owned Vec: clone (the
hot per-request/per-record operation) is one atomic increment and
zero allocation; only new/child (scope creation) allocate.
Implementations§
Source§impl Signal
impl Signal
pub fn new() -> Self
Sourcepub fn child(&self) -> Self
pub fn child(&self) -> Self
A nested scope: observes every ancestor level plus a fresh one of its own. Firing the child never touches the ancestors.
Sourcepub fn fire(&self)
pub fn fire(&self)
Fire this handle’s own scope level (idempotent). Ancestor levels are never fired through a child handle.
Sourcepub fn fired(&self) -> Fired ⓘ
pub fn fired(&self) -> Fired ⓘ
Resolves when this scope or any ancestor fires; resolves immediately if that already happened (sticky level).
Sourcepub fn guard(self) -> SignalGuard
pub fn guard(self) -> SignalGuard
Fire-on-drop guard for tying a scope’s lifetime to a value (e.g. cancel a request’s subtree when its driver unwinds).
Trait Implementations§
Auto Trait Implementations§
impl Freeze 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