envzn
0.8 · beta · not released

Library / Collections / Dictionaries / BinaryWord

CLASSIMPLEMENTS Cloneable, Hashable, Equatable<BinaryWord>, Comparable<BinaryWord>

BinaryWord

A BORROWED window onto a run of bytes: the array, where the run starts, and how long it is. Value-copied and inline — copying a BinaryWord copies three machine words, never the bytes.

Constructors 1

INIT(REFERENCE binary[] src, int64 off, int64 len)

Methods 7

METHOD length() RETURNS int64
reads

Bytes in the window.

METHOD offset() RETURNS int64
reads

Where the window opens in the underlying pool. A caller holding the pool can use this with length() to reach the bytes directly — which is how the slice fast paths avoid going through the window at all.

METHOD at(int64 i) RETURNS | binary
reads

The byte at i within the window, or FAILURE when i is outside it.

METHOD clone() RETURNS BinaryWord
reads
METHOD hash() RETURNS uint64
reads
METHOD equals(REFERENCE BinaryWord other) RETURNS boolean
reads

Equal when the windows hold the same bytes — not when they name the same place. Two words over different pools are equal if their bytes match.

METHOD isLessThan(REFERENCE BinaryWord other) RETURNS boolean
reads

Lexicographic by bytes, shorter-is-less on a shared prefix — the order a byte-keyed tree needs to stay total.