Skip to main content

Module bytes

Module bytes 

Source
Expand description

Opaque compile-time byte blobs — constants wider than a Literal can hold.

A numeric Literal is a single u64; constants that exceed 64 bits (SSE/AVX register pools, wide stack/memory reads, the result of coalescing several adjacent constant stores) cannot be represented that way without breaking the u64-centric folding pipeline. A Bytes value sidesteps that: it is a raw, opaque byte vector with no arithmetic meaning, stored as a little-endian, memory-order snapshot (data[i] is the byte at base + i, matching the target’s fixed little-endian layout).

Every Bytes carries a TypeId — typically an Array(i8, len) — with the invariant size_of(type_id) == data.len(), enforced at construction. Unlike numeric literals, Bytes values are not interned: each construction produces a fresh BytesId, so downstream equality must compare contents, never IDs.

Structs§

Bytes
A compile-time opaque byte blob stored in a Context.
BytesId

Enums§

BytesDisplay
How a Bytes blob should be rendered as a b"..." literal.
StringEncoding
The encoding under which a byte blob was successfully read as text.

Functions§

decode_string
Attempt to decode data as a printable ASCII or UTF-16LE string.
escape_decoded
Escape a decoded string for display inside b"..." quotes.
render_bytes_literal
Render data as the full b"..." literal text under mode.

Type Aliases§

BytesRef