Collections

Operations on vector<T> — the primary ordered collection type. Vectors are grown by appending with += and elements are accessed by index. A vector or struct passed to a function is passed by reference: the callee's appends and element writes reach the caller. Binding one to a new local (`w = v`) copies it.

pub fn len(self: const vector) -> integer

Number of elements in the vector. Use in loop bounds: for i in 0..v.len().

pub fn len(self: const sorted) -> integer

Number of elements in a sorted collection.

pub fn clear(self: vector)

Remove all elements from the vector, setting its length to 0.

pub fn len(self: const hash) -> integer

Number of elements in a hash collection.

pub fn size(self: const hash) -> integer

The byte footprint of a hash: its full bucket table, holes included. The table is the hash's own allocation — elms slots, each a 4-byte record-id (an empty slot is a hole and still counts, because open addressing's spare capacity IS the format). Allocation-local: the entry records live in separate allocations and are not counted. Grows in steps as the table rehashes (it is rebuilt at half full). 0 for an empty (unallocated) hash.

pub fn size(self: const index) -> integer

The byte footprint of an index: its B+tree's node arena, room included. Allocation-local, as size of a hash: the element records live in separate allocations and are not counted. Grows in steps as the arena doubles. 0 for an empty (unallocated) index.