pub struct ShutdownSignal { /* private fields */ }Expand description
Cooperative shutdown signal handed to a plugin’s background work.
A plugin that maintains derived state generally wants a worker: something that drains the hook bus, re-embeds changed notes, compacts an index. That work outlives any single tool call, so it needs a way to learn the host is going away — otherwise a detached task keeps running against state that is being torn down, and the process cannot exit cleanly.
Cheap to clone; every clone observes the same signal.
Implementations§
Source§impl ShutdownSignal
impl ShutdownSignal
Sourcepub fn is_shutting_down(&self) -> bool
pub fn is_shutting_down(&self) -> bool
Whether shutdown has already been requested.
Check this at the top of a work loop; use Self::cancelled to wait.
Trait Implementations§
Source§impl Clone for ShutdownSignal
impl Clone for ShutdownSignal
Source§fn clone(&self) -> ShutdownSignal
fn clone(&self) -> ShutdownSignal
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ShutdownSignal
impl RefUnwindSafe for ShutdownSignal
impl Send for ShutdownSignal
impl Sync for ShutdownSignal
impl Unpin for ShutdownSignal
impl UnsafeUnpin for ShutdownSignal
impl UnwindSafe for ShutdownSignal
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