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

FileWriteError

Preserves both primary whole-file transfer and secondary close failures. Reason retains the proven transferred byte prefix. CleanupError is populated only when close also fails after an earlier transfer failure; successful writes followed by close failure use close as Reason instead. No rollback is implied. This record owns reasons, allocates nothing and retains no file/input view.

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

import std.fs;

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

FileWriteError

pub struct FileWriteError

Preserves both primary whole-file transfer and secondary close failures. Reason retains the proven transferred byte prefix. CleanupError is populated only when close also fails after an earlier transfer failure; successful writes followed by close failure use close as Reason instead. No rollback is implied. This record owns reasons, allocates nothing and retains no file/input view.

FileWriteError.Reason

pub Reason: IoError;

Primary portable open/transfer/close failure.

FileWriteError.CleanupError

pub CleanupError: IoError?;

Optional secondary close failure.

FileWriteError.Create

pub static fn Create(Reason: IoError, CleanupError: IoError?) -> FileWriteError

Copies exact failure identities without allocation. Reason: Primary failure. CleanupError: Optional secondary close failure. Return: Independent Data failure record without retained storage.

FileWriteError.Create

pub static fn Create(Reason: IoError) -> FileWriteError

Supplies the omitted secondary failure to Create. Note: Defaults: CleanupError = none. Reason: Same input, ownership and lifetime contract as the full operation. Return: Independent Data failure with no secondary close failure.

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