Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

std

NameSummary
arrayArray<T, N>: N values of type T, and ways to build new arrays from old ones. Every value is immutable, so each operation returns a new array.
binaryFixed-width binary values: bits<N>, signed<N>, bool, and byte order.
bitfieldBit ranges, written the way ISA manuals write them. slice(x, 10, 5) is the manual’s x[10:5]: hi and lo are inclusive bit numbers, so a one-bit field is (n, n). The shift, the mask and the result’s width all come from those two numbers, so they can’t disagree.
bitter/byte_order, deferred, layout, link
ctypesC’s fixed-width integer names. The signed ones are signed<N>, stored in two’s complement; the unsigned ones are bits<N> that can’t be negative.
decimalExact non-integer numbers, for compile-time math: Decimal, a value scaled by a power of ten, and Fraction, a numerator over a denominator. Both convert to and from int with as.
enumeratedEnumerated<T>: a value paired with its position.
formats/elf, macho, pe
iterStepped ranges of integers, for @for.
mathInteger math, and fixed-point math on Decimal and Fraction, all evaluated at compile time.
optionOption<T>: a value that may be missing.
pdp10/impl, tops10
riscv/c_like, impl, native
stringStrings packed into one integer. A string literal like "hi" is a struct of code points; string_from_struct encodes it as UTF-8 bytes in a single int, with its length in bytes.
unsigneduint, an int that can’t be negative.
wasm/impl, leb128, module
x86_64/att, impl, intel, nasm