Under heavy development. This site describes the intended 1.0 language. Current features and performance vary. Development status
Sn50SnThe SnAPI programming language
0.2.0 Preview 1 · Frozen documentation

ChannelAsyncIterator

Retains one channel's private FIFO state for incremental owned receives. Independent cursors compete for queue items; they do not replay a sequence. The visible Channel remains closing authority. After it closes, retained cursors drain buffered values before EOF. One mutable step may be outstanding; cursor movement/destruction obeys its live receiver loan. Construction retains state without allocating new backing. Each step has ordinary task/provider costs, awaits outside queue guards and briefly locks only during transfer. EOF is sticky. Cancellation/provider error does not latch EOF.

Sn is under heavy development. Reference extracted from this release’s bundled standard library. Public API examples are not an exhaustive compatibility test. Read the matching release guide for tested workflows and limitations. Read the status →

Module std.sync

import std.sync;

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

ChannelAsyncIterator

pub final class ChannelAsyncIterator<T> where T: Movable

Retains one channel's private FIFO state for incremental owned receives. Independent cursors compete for queue items; they do not replay a sequence. The visible Channel remains closing authority. After it closes, retained cursors drain buffered values before EOF. One mutable step may be outstanding; cursor movement/destruction obeys its live receiver loan. Construction retains state without allocating new backing. Each step has ordinary task/provider costs, awaits outside queue guards and briefly locks only during transfer. EOF is sticky. Cancellation/provider error does not latch EOF. T: Movable received payload, transferred exactly once.

ChannelAsyncIterator.init

pub init()

Creates an inert cursor without allocation.

ChannelAsyncIterator.init

pub init(Source: readonly Self&) = delete;

Rejects implicit duplicate consumer state. Source: Existing cursor.

ChannelAsyncIterator.init

pub init(Source: mut Self&&)

Transfers retention and EOF state without advancing. Source: Cursor left inert.

ChannelAsyncIterator.operator

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

Rejects implicit consumer duplication. Source: Existing cursor. Return: No runtime result; this assignment is deleted and cannot be invoked.

ChannelAsyncIterator.operator

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

Rejects implicit replacement of an incremental consumer. Source: Existing cursor. Return: No runtime result; this assignment is deleted and cannot be invoked.

ChannelAsyncIterator.NextAsync

pub async fn NextAsync(mut Token: CancellationToken) -> Task<Result<T?, ChannelError>>

Receives one owned item, latching successful closed EOF. Token: Owned cancellation observation, effective while pending only. Return: Task yielding exact owned item/EOF or portable failure. Warning: Do not overlap steps or move/dispose a cursor with a pending step.

ChannelAsyncIterator.NextAsync

pub fn NextAsync() -> Task<Result<T?, ChannelError>>

Supplies the omitted arguments to NextAsync. Note: Defaults: Token = CancellationToken(). Return: Exact full-operation result; no additional async frame is created.

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