pub struct CancelToken(/* private fields */);Implementations§
Source§impl CancelToken
impl CancelToken
pub fn is_cancelled(&self) -> bool
Sourcepub fn standalone() -> (Self, CancelHandle)
pub fn standalone() -> (Self, CancelHandle)
A token plus the handle that cancels it, for owners running their
own scheduling loop rather than the engine’s worker pool (0058
WK04: the worker session cancels admitted requests by protocol
cancel and lease teardown, not pool bookkeeping). Dropping the
handle without cancelling still cancels (OwnerClosed), matching
the pool’s abandon semantics.
Sourcepub fn register_cancel_resource(
&self,
resource: impl FnOnce() -> Result<(), Failure> + Send + 'static,
) -> Result<(), Failure>
pub fn register_cancel_resource( &self, resource: impl FnOnce() -> Result<(), Failure> + Send + 'static, ) -> Result<(), Failure>
Install the single optional resource hook before acquiring native resources. A late installation executes immediately and returns its failure to the installer. Hooks must be prompt: they must not join or wait for workers. A resource published after cancellation must also be revoked by its owner.
Sourcepub fn clear_cancel_resource(&self)
pub fn clear_cancel_resource(&self)
Call only after normal resource cleanup. An already detached callback may still run; the resource itself must serialize revocation and reuse.