Snapshot · Oct 24, 2026 · Frozen documentation
AllocationError
Classifies recoverable raw-storage and layout failures.
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.memory
import std.memory;Public declaration contracts and authored examples. A page can document several related symbols. Implementation bodies are excluded.
AllocationError
pub enum AllocationErrorClassifies recoverable raw-storage and layout failures.
The cases are portable and allocation-free. They intentionally preserve no target allocator status code; target-private adapters translate at their boundary.
Example
module example.allocation_error;
from std.memory import AllocationError, Layout;
fn Main() -> i32 {
switch Layout.ArrayOf<u64>(4) {
case .Ok { Value = _ } => return 0;
case .Err { Error = Error } => {
if Error == .SizeOverflow { return 2; }
return 1;
}
}
}Documentation snapshot: October 24, 2026 About versions ↗