Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

I/O errors

IoError is an allocation-free enum:

VariantMeaning
System(i32)Native OS error code, only when the OS supplied one
Data(DataError.InvalidUtf8)Invalid or truncated UTF-8
Data(DataError.Allocation(AllocError))Recoverable buffer/result allocation failure
InvalidModeUnsupported computed open mode
ClosedFile is closed
NotReadableFile lacks read capability
NotWritableFile lacks write capability
InvalidInputInvalid argument, such as NUL in a path or negative truncation size
UnsupportedUnsupported host operation
OtherFailure without a native code or more specific variant

Constructing, matching, and propagating these errors adds no allocation. The ordinary error rules determine whether details are retained or erased by builtin Failure.

File operations report Closed before mode errors. Reads and writes validate capabilities even for zero-length work. Negative read limits mean unbounded reading; they are valid, unlike negative truncation sizes.

An error can follow consumed input, a written prefix, or other external effects. The operation’s page states its cleanup and preservation guarantees.