Trait alure::instr::bytecode::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
fn byte_count(&self) -> u16
[src]
fn byte_count(&self) -> u16
[src]Returns number of bytes which instruction and its argument occupies
fn instr_range() -> RangeInclusive<u8>
[src]
fn instr_range() -> RangeInclusive<u8>
[src]Returns range of instruction btecodes covered by a set of operations
fn instr_byte(&self) -> u8
[src]
fn instr_byte(&self) -> u8
[src]Returns byte representing instruction code (without its arguments)
fn write_args<W>(&self, writer: &mut W) -> Result<(), EncodeError> where
W: Write,
EncodeError: From<<W as Write>::Error>,
[src]
fn write_args<W>(&self, writer: &mut W) -> Result<(), EncodeError> where
W: Write,
EncodeError: From<<W as Write>::Error>,
[src]Writes instruction arguments as bytecode, omitting instruction code byte
fn read<R>(reader: &mut R) -> Result<Self, DecodeError> where
Self: Sized,
R: Read,
DecodeError: From<<R as Read>::Error>,
[src]
fn read<R>(reader: &mut R) -> Result<Self, DecodeError> where
Self: Sized,
R: Read,
DecodeError: From<<R as Read>::Error>,
[src]Reads the instruction from bytecode
Provided methods
fn write<W>(&self, writer: &mut W) -> Result<(), EncodeError> where
W: Write,
EncodeError: From<<W as Write>::Error>,
[src]
fn write<W>(&self, writer: &mut W) -> Result<(), EncodeError> where
W: Write,
EncodeError: From<<W as Write>::Error>,
[src]Writes the instruction as bytecode
Implementors
impl Bytecode for ArithmeticOp
[src]
impl Bytecode for ArithmeticOp
[src]fn byte_count(&self) -> u16
[src]
fn instr_range() -> RangeInclusive<u8>
[src]
fn instr_byte(&self) -> u8
[src]
fn write_args<W>(&self, writer: &mut W) -> Result<(), EncodeError> where
W: Write,
EncodeError: From<<W as Write>::Error>,
[src]
W: Write,
EncodeError: From<<W as Write>::Error>,
fn read<R>(reader: &mut R) -> Result<Self, DecodeError> where
R: Read,
DecodeError: From<<R as Read>::Error>,
[src]
R: Read,
DecodeError: From<<R as Read>::Error>,
impl Bytecode for BitwiseOp
[src]
impl Bytecode for BitwiseOp
[src]fn byte_count(&self) -> u16
[src]
fn instr_range() -> RangeInclusive<u8>
[src]
fn instr_byte(&self) -> u8
[src]
fn write_args<W>(&self, writer: &mut W) -> Result<(), EncodeError> where
W: Write,
EncodeError: From<<W as Write>::Error>,
[src]
W: Write,
EncodeError: From<<W as Write>::Error>,
fn read<R>(reader: &mut R) -> Result<Self, DecodeError> where
R: Read,
DecodeError: From<<R as Read>::Error>,
[src]
R: Read,
DecodeError: From<<R as Read>::Error>,
impl Bytecode for BytesOp
[src]
impl Bytecode for BytesOp
[src]fn byte_count(&self) -> u16
[src]
fn instr_range() -> RangeInclusive<u8>
[src]
fn instr_byte(&self) -> u8
[src]
fn write_args<W>(&self, writer: &mut W) -> Result<(), EncodeError> where
W: Write,
EncodeError: From<<W as Write>::Error>,
[src]
W: Write,
EncodeError: From<<W as Write>::Error>,
fn read<R>(reader: &mut R) -> Result<Self, DecodeError> where
R: Read,
DecodeError: From<<R as Read>::Error>,
[src]
R: Read,
DecodeError: From<<R as Read>::Error>,
impl Bytecode for CmpOp
[src]
impl Bytecode for CmpOp
[src]fn byte_count(&self) -> u16
[src]
fn instr_range() -> RangeInclusive<u8>
[src]
fn instr_byte(&self) -> u8
[src]
fn write_args<W>(&self, writer: &mut W) -> Result<(), EncodeError> where
W: Write,
EncodeError: From<<W as Write>::Error>,
[src]
W: Write,
EncodeError: From<<W as Write>::Error>,
fn read<R>(reader: &mut R) -> Result<Self, DecodeError> where
R: Read,
DecodeError: From<<R as Read>::Error>,
[src]
R: Read,
DecodeError: From<<R as Read>::Error>,
impl Bytecode for ControlFlowOp
[src]
impl Bytecode for ControlFlowOp
[src]fn byte_count(&self) -> u16
[src]
fn instr_range() -> RangeInclusive<u8>
[src]
fn instr_byte(&self) -> u8
[src]
fn write_args<W>(&self, writer: &mut W) -> Result<(), EncodeError> where
W: Write,
EncodeError: From<<W as Write>::Error>,
[src]
W: Write,
EncodeError: From<<W as Write>::Error>,
fn read<R>(reader: &mut R) -> Result<Self, DecodeError> where
R: Read,
DecodeError: From<<R as Read>::Error>,
[src]
R: Read,
DecodeError: From<<R as Read>::Error>,
impl Bytecode for Curve25519Op
[src]
impl Bytecode for Curve25519Op
[src]fn byte_count(&self) -> u16
[src]
fn instr_range() -> RangeInclusive<u8>
[src]
fn instr_byte(&self) -> u8
[src]
fn write_args<W>(&self, writer: &mut W) -> Result<(), EncodeError> where
W: Write,
EncodeError: From<<W as Write>::Error>,
[src]
W: Write,
EncodeError: From<<W as Write>::Error>,
fn read<R>(reader: &mut R) -> Result<Self, DecodeError> where
R: Read,
DecodeError: From<<R as Read>::Error>,
[src]
R: Read,
DecodeError: From<<R as Read>::Error>,
impl Bytecode for DigestOp
[src]
impl Bytecode for DigestOp
[src]fn byte_count(&self) -> u16
[src]
fn instr_range() -> RangeInclusive<u8>
[src]
fn instr_byte(&self) -> u8
[src]
fn write_args<W>(&self, writer: &mut W) -> Result<(), EncodeError> where
W: Write,
EncodeError: From<<W as Write>::Error>,
[src]
W: Write,
EncodeError: From<<W as Write>::Error>,
fn read<R>(reader: &mut R) -> Result<Self, DecodeError> where
R: Read,
DecodeError: From<<R as Read>::Error>,
[src]
R: Read,
DecodeError: From<<R as Read>::Error>,
impl Bytecode for MoveOp
[src]
impl Bytecode for MoveOp
[src]fn byte_count(&self) -> u16
[src]
fn instr_range() -> RangeInclusive<u8>
[src]
fn instr_byte(&self) -> u8
[src]
fn write_args<W>(&self, writer: &mut W) -> Result<(), EncodeError> where
W: Write,
EncodeError: From<<W as Write>::Error>,
[src]
W: Write,
EncodeError: From<<W as Write>::Error>,
fn read<R>(reader: &mut R) -> Result<Self, DecodeError> where
R: Read,
DecodeError: From<<R as Read>::Error>,
[src]
R: Read,
DecodeError: From<<R as Read>::Error>,
impl Bytecode for NOp
[src]
impl Bytecode for NOp
[src]fn byte_count(&self) -> u16
[src]
fn instr_range() -> RangeInclusive<u8>
[src]
fn instr_byte(&self) -> u8
[src]
fn write_args<W>(&self, _writer: &mut W) -> Result<(), EncodeError> where
W: Write,
EncodeError: From<<W as Write>::Error>,
[src]
W: Write,
EncodeError: From<<W as Write>::Error>,
fn read<R>(reader: &mut R) -> Result<Self, DecodeError> where
R: Read,
DecodeError: From<<R as Read>::Error>,
[src]
R: Read,
DecodeError: From<<R as Read>::Error>,
impl Bytecode for PutOp
[src]
impl Bytecode for PutOp
[src]fn byte_count(&self) -> u16
[src]
fn instr_range() -> RangeInclusive<u8>
[src]
fn instr_byte(&self) -> u8
[src]
fn write_args<W>(&self, writer: &mut W) -> Result<(), EncodeError> where
W: Write,
EncodeError: From<<W as Write>::Error>,
[src]
W: Write,
EncodeError: From<<W as Write>::Error>,
fn read<R>(reader: &mut R) -> Result<Self, DecodeError> where
R: Read,
DecodeError: From<<R as Read>::Error>,
[src]
R: Read,
DecodeError: From<<R as Read>::Error>,
impl Bytecode for Secp256k1Op
[src]
impl Bytecode for Secp256k1Op
[src]fn byte_count(&self) -> u16
[src]
fn instr_range() -> RangeInclusive<u8>
[src]
fn instr_byte(&self) -> u8
[src]
fn write_args<W>(&self, writer: &mut W) -> Result<(), EncodeError> where
W: Write,
EncodeError: From<<W as Write>::Error>,
[src]
W: Write,
EncodeError: From<<W as Write>::Error>,
fn read<R>(reader: &mut R) -> Result<Self, DecodeError> where
R: Read,
DecodeError: From<<R as Read>::Error>,
[src]
R: Read,
DecodeError: From<<R as Read>::Error>,
impl<Extension> Bytecode for Instr<Extension> where
Extension: InstructionSet,
[src]
impl<Extension> Bytecode for Instr<Extension> where
Extension: InstructionSet,
[src]fn byte_count(&self) -> u16
[src]
fn instr_range() -> RangeInclusive<u8>
[src]
fn instr_byte(&self) -> u8
[src]
fn write_args<W>(&self, writer: &mut W) -> Result<(), EncodeError> where
W: Write,
EncodeError: From<<W as Write>::Error>,
[src]
W: Write,
EncodeError: From<<W as Write>::Error>,
fn read<R>(reader: &mut R) -> Result<Self, DecodeError> where
R: Read,
DecodeError: From<<R as Read>::Error>,
[src]
R: Read,
DecodeError: From<<R as Read>::Error>,