Under heavy development. This site describes the intended 1.0 language. Current features and performance vary. Development status
Sn50SnThe SnAPI programming language
Development · Evolving reference

SharedTask

Retains repeated readonly observation of one asynchronous completion.

Sn is under heavy development. This reference includes the intended 1.0 design; features may be incomplete in the current compiler. Read the status →

Module std.task

import std.task;

Public declaration contracts and authored examples. A page can document several related symbols. Implementation bodies are excluded.

SharedTask

pub final class SharedTask<T>

Retains repeated readonly observation of one asynchronous completion. T: Owned completion kept alive by shared visible/native owners; void has no value. @details Copying retains the same frame without copying T or allocating. Await yields readonly T&; its borrow retains no owner and must end before the last protecting shared handle is moved, destroyed or replaced.

SharedTask.init

pub init()

Initializes an empty shared handle without allocation.

SharedTask.init

pub init(Source: readonly Self&)

Retains Source's frame without copying its result. Source: Existing shared owner, or empty handle.

SharedTask.init

pub init(Source: mut Self&&)

Moves the shared owner without retaining it again. Source: Explicitly moved owner left empty.

SharedTask.operator

pub fn operator =(Source: readonly Self&) -> void

Retains Source before releasing the replaced owner. Source: Existing shared owner; exact self-assignment is harmless. Return: No value.

SharedTask.operator

pub fn operator =(Source: mut Self&&) -> void

Moves Source after releasing the replaced owner, with harmless self-assignment. Source: Explicitly moved shared owner left empty. Return: No value.

SharedTask.IsCompleted

pub IsCompleted: bool;

Observes terminal publication without creating a result borrow. Return: False for empty/pending, true after completion.

Documentation snapshot: October 24, 2026 About versions ↗
Searching Development · language & standard library