Skip to main content

instructions

Function instructions 

Source
pub fn instructions(bytes: &[u8]) -> Result<Vec<EncodedInst>, Truncated>
Expand description

Reads a run of bytes as instructions, refusing a partial one.

The one place truncation is a question a fixed width can be asked: an EncodedInst is always sixteen bytes, so a short instruction cannot exist, but a short stream can — a file cut off, a Uint8Array handed across the Wasm boundary with the wrong length. This is where that is refused, before anything indexes into it.