Trait alure::instr::serialize::Bytecode[][src]

pub trait Bytecode {
    fn byte_count(&self) -> u16;
fn instr_range() -> RangeInclusive<u8>;
fn instr_byte(&self) -> u8;
fn write_args<W>(&self, writer: &mut W) -> Result<(), EncodeError>
    where
        W: Write,
        EncodeError: From<<W as Write>::Error>
;
fn read<R>(reader: &mut R) -> Result<Self, DecodeError>
    where
        Self: Sized,
        R: Read,
        DecodeError: From<<R as Read>::Error>
; fn write<W>(&self, writer: &mut W) -> Result<(), EncodeError>
    where
        W: Write,
        EncodeError: From<<W as Write>::Error>
, { ... } }
Expand description

Non-failiable byte encoding for the instruction set. We can’t use io since (1) we are no_std, (2) it operates data with unlimited length (while we are bound by u16), (3) it provides too many fails in situations when we can’t fail because of u16-bounding and exclusive in-memory encoding handling.

Required methods

Returns number of bytes which instruction and its argument occupies

Returns range of instruction btecodes covered by a set of operations

Returns byte representing instruction code (without its arguments)

Writes instruction arguments as bytecode, omitting instruction code byte

Reads the instruction from bytecode

Provided methods

Writes the instruction as bytecode

Implementors