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

ReadBytesAsync

Collects a complete byte stream into explicit owned storage. Reserves before each read so valid partial provider progress remains owned on failure. Short reads continue until successful zero-byte EOF. Counts are checked before indexing; source failure never discards the already consumed prefix. Geometric storage growth may retain spare capacity beyond the read scratch.

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.io

import std.io;

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

ReadBytesAsync

pub async fn ReadBytesAsync<S>(Source: mut S&, Token: CancellationToken) -> Task<Result<Vector<byte>, StreamReadError>> where S: AsyncReader

Collects a complete byte stream into explicit owned storage. Reserves before each read so valid partial provider progress remains owned on failure. Short reads continue until successful zero-byte EOF. Counts are checked before indexing; source failure never discards the already consumed prefix. Geometric storage growth may retain spare capacity beyond the read scratch. S: Structural AsyncReader source type. Source: Borrowed mutable stream, retained through completion. Token: Cancellation observation copied into sequential child reads. Return: Task yielding owned bytes or failure owning every proven consumed byte. Warning: May allocate and suspend; consumes until EOF without a fixed total-size bound.

ReadBytesAsync

pub fn ReadBytesAsync<S>(Source: mut S&) -> Task<Result<Vector<byte>, StreamReadError>> where S: AsyncReader

Supplies the omitted arguments to ReadBytesAsync. Note: Defaults: Token = CancellationToken(). S: Same generic argument and constraints as the full operation. Source: Same input, ownership and lifetime contract as the full operation. Return: Exact full-operation result; no additional async frame is created.

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