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.
CancellationToken.init
pub init()Creates inert observation without allocation.
CancellationToken.init
pub init(Source: readonly Self&)Retains existing backing without allocation. Source: Retained token.
CancellationToken.init
pub init(Source: mut Self&&)Transfers backing and clears Source. Source: Explicit moved token.
CancellationToken.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.
CancellationToken.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.
CancellationToken.CanBeCancelled
pub CanBeCancelled: bool;Reports whether observation has backing authority. Return: False for default/moved token.
CancellationToken.IsCancellationRequested
pub IsCancellationRequested: bool;Acquires cooperative request state without scheduling. Return: True after cancellation request, false for inert token.