OxL Reference

module std.io

std.io — files, directories, paths and standard input (II.1). Errors are IoError (std.core). Decisions D-3130..D-3139.

Whole-file reads and writes use the task-aware io layer (io_uring, or the blocking pool when it is unavailable); metadata and directory operations run on the blocking pool inside a task. Every operation has the effect io. Paths are plain str (UTF-8); Path has the text operations (join, parent, extension, normalize).

Example:

oxl✓ checked in CI
use std.io { File, fs }

fn main() io {
  let dir = fs.tempDir()!
  File.writeText("{dir}/note.txt", "hello")!
  print("{File.readText("{dir}/note.txt")!} {File.exists("{dir}/note.txt")}")
  fs.removeAll(dir)!
}
Output
hello true

Types

data DirEntryOne entry of a directory listing
data FileNamespace of file operations.
enum FileKindWhat a path is (metadata does not follow symbolic links; stat does).
data fsNamespace of directory operations.
data MetadataSize, kind and times of a file system entry.
data PathText operations on /-separated paths; nothing touches the file system.

Functions

readLineOne line of standard input without the line break, none at end of input.

See also