This library is in flux. APIs may change without notice. Generated from source with koruc 0.1.7 on 8/19/2026.

Map

~import std/map

std/map — a hash map of i64 keys → i64 values, with the same owned-handle

map.kz · 6 tors

std/map — a hash map of i64 keys → i64 values, with the same owned-handle · 15 more lines
std/map — a hash map of i64 keys → i64 values, with the same owned-handle ownership model as std/set (map IS set-with-values: set is AutoHashMapUnmanaged(i64, void), map is AutoHashMapUnmanaged(i64, i64)). First cut: i64→i64 (pack composite keys — e.g. a 2D coordinate — into one i64 at the call site); genericity over the key/value types lands later by replication (same as list / grid / set). Backed by Zig's std.AutoHashMapUnmanaged — the hashing has no business being in Koru and isn't; the map is the thin owned-handle surface over it, exactly like set is over the keys-only table. Ownership states (phantom on *Map_i64_i64): <map!> - new issues the obligation: this map must be freed. <map> - borrowed: set / get / contains / count, obligation untouched. <!map> - consumed: free discharges the obligation.

Phantom lifecycles

Derived from the phantom labels in the declarations below — state! issues an obligation the compiler will chase, !state discharges it, a bare state holds it without moving it. Nothing here is hand-drawn.

Map_i64_i64 1 state map!

new

aspirational <map!> koru_std/map.kz:45

contains

<map> koru_std/map.kz:88