Skip to main content

encode_bytes

Function encode_bytes 

Source
pub fn encode_bytes(length: u32, value: &RuntimeValue) -> Result<AlignedValue>
Expand description

Encode a fixed-length Bytes literal. Accepts hex-encoded strings.

The encoded AlignedValue is built directly from Value + Alignment::singleton(AlignmentAtom::Bytes { length: N }) so any declared length is supported (the JS path’s _descriptor_N.toValue(...) produces the same shape for arbitrary N). The ValueAtom::from([u8; N]) impl strips trailing zeros, so we produce the same wire bytes by mirroring that strip rule on the raw vec.