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

DirectoryIterator

Owns consuming directory traversal and transfers independent entry owners. Successful EOF is sticky. Next yields one error item then ends, preventing repeated terminal failures. External synchronization is required; destruction closes remaining enumeration synchronously. No raw native entry or borrowed name escapes.

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

import std.fs;

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

DirectoryIterator

pub final class DirectoryIterator

Owns consuming directory traversal and transfers independent entry owners. Successful EOF is sticky. Next yields one error item then ends, preventing repeated terminal failures. External synchronization is required; destruction closes remaining enumeration synchronously. No raw native entry or borrowed name escapes.

DirectoryIterator.init

pub init()

Creates an inert allocation-free cursor.

DirectoryIterator.init

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

Rejects duplicated traversal authority. Source: Existing cursor.

DirectoryIterator.init

pub init(Source: mut Self&&)

Transfers remaining enumeration and terminal state. Source: Cursor left exhausted.

DirectoryIterator.operator

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

Rejects duplicated enumeration authority. Source: Existing cursor. Return: No runtime result; this assignment is deleted and cannot be invoked.

DirectoryIterator.operator

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

Requires explicit owner cleanup before replacement. Source: Existing cursor. Return: No runtime result; this assignment is deleted and cannot be invoked.

DirectoryIterator.Next

pub fn Next() -> Result<DirectoryEntry, IoError>?

Transfers one owned entry result, yielding a terminal error only once. Return: Optional Result item, or none after EOF/error/inert movement. Warning: May allocate/block; consume each Result before treating it as an entry.

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