Skip to main content

BYTES

Constant BYTES 

Source
pub const BYTES: FunctionDescriptor;
Expand description

Builds immutable bytes from checked unsigned 8-bit values.

Each element is a u8, so out-of-range literal bytes are compile errors. The Bin owns shared immutable storage and has no text encoding until decoded explicitly.

§Signature

func bytes(values: List[u8]) -> Bin

§Builds immutable bytes from checked unsigned 8-bit values

Run the example, then change the data and inspect the result.

let payload: Bin = bytes([65, 66]);
print(payload.decode()?);