Snapshot · Oct 24, 2026 · Frozen documentation
Indexable
Defines the exact canonical read indexing protocol used by `Base[Index]`.
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.collections
import std.collections;Public declaration contracts and authored examples. A page can document several related symbols. Implementation bodies are excluded.
Indexable
pub concept Indexable<Self>Defines the exact canonical read indexing protocol used by Base[Index].
Satisfaction is structural and compile-time-only. The operation returns an element place rather than copying an item, allocates nothing, and remains responsible for its own bounds policy.
Example
module example.indexable;
from std.collections import Vector;
fn Main() -> i32 {
var Values = Vector<i32>();
if Values.TryPush(4) is .Err { Error = Failure } {
return Failure.Value;
}
Values[0] = 9;
let ReadOnly: readonly i32[] = Values.AsSlice();
if ReadOnly[0] != 9 {
return 1;
}
return 0;
}WritableIndexable
pub concept WritableIndexable<Self>Extends canonical indexing with writable element-place access. Self: Mutable source type satisfying both exact At requirements.
Documentation snapshot: October 24, 2026 About versions ↗