CancellationToken
Retains copyable cooperative cancellation observation independently of authority. Defaults are inert. Copies and observations allocate nothing. Distinct retained tokens may be observed concurrently; move/assignment of one handle needs external serialization. Destruction never requests cancellation or waits for completion.
Module std.task
import std.task;Public declaration contracts and authored examples. A page can document several related symbols. Implementation bodies are excluded.
CancellationToken
pub final class CancellationTokenRetains copyable cooperative cancellation observation independently of authority. Defaults are inert. Copies and observations allocate nothing. Distinct retained tokens may be observed concurrently; move/assignment of one handle needs external serialization. Destruction never requests cancellation or waits for completion.
pub init()
pub init()Creates inert observation without allocation.
pub init(Source: readonly Self&)
pub init(Source: readonly Self&)Retains existing backing without allocation. Source: Retained token.
pub init(Source: mut Self&&)
pub init(Source: mut Self&&)Transfers backing and clears Source. Source: Explicit moved token.
operator
pub fn operator =(Source: readonly Self&) -> voidRetains before releasing old backing, including exact self-assignment. Source: Retained token. Return: No value after retaining Source and releasing the previous token lease.
operator
pub fn operator =(Source: mut Self&&) -> voidTransfers backing without allocation, preserving exact self-move. Source: Explicit moved token. Return: No value after transferring the token lease; exact self-move is unchanged.
pub CanBeCancelled: bool
pub CanBeCancelled: boolReports whether observation has backing authority. Return: False for default/moved token.
pub IsCancellationRequested: bool
pub IsCancellationRequested: boolAcquires cooperative request state without scheduling. Return: True after cancellation request, false for inert token.