Bytes
Bytes module: raw byte manipulation.
Bytes wraps a List(Int) of byte values in the range 0–255. March strings are UTF-8 byte sequences; Bytes exposes the raw bytes. All encoding functions (hex, base64) are implemented in pure March.
This module is self-contained: it does not depend on List. or String. being loaded, so it can be tested or used in isolation.
Types
Functions
Unwrap Bytes to the underlying List(Int).
Convert a String to Bytes (raw UTF-8 byte values, each 0–255).
Convert Bytes back to a String (bytes interpreted as UTF-8).
Number of bytes.
True if the Bytes is empty.
Byte at position i (0-based). Panics if out of bounds.
Sub-slice: bytes from position start with given length.
Concatenate two Bytes values.
Encode a String as UTF-8 bytes. Equivalent to from_string for March strings.
Decode UTF-8 bytes to a String. Returns Ok(s) always (same as to_string).
Encode Bytes as a lowercase hexadecimal string.
Parse a hex string to Bytes. Returns Err if the input is not valid hex.
Encode Bytes as a Base64 string (with padding).
Decode a Base64 string to Bytes. Returns Err on invalid input.