Skip to main content

EmbeddableParam

Trait EmbeddableParam 

Source
pub trait EmbeddableParam: Sized {
    // Required methods
    fn extract(value: u8) -> Result<Self, ParseError>;
    fn embed(&self) -> u8;

    // Provided methods
    fn extract_from_opcode(
        opcode: u8,
        pos: OpcodePosition,
    ) -> Result<Self, ParseError> { ... }
    fn embed_to_opcode(&self, opcode: u8, pos: OpcodePosition) -> u8 { ... }
}
Expand description

A value that can be embedded in an opcode

Required Methods§

Source

fn extract(value: u8) -> Result<Self, ParseError>

Extracts the value from a given opcode. The value should be aligned to a byte for this method

Source

fn embed(&self) -> u8

Returns a value to be embedded in an opcode.

Provided Methods§

Source

fn extract_from_opcode( opcode: u8, pos: OpcodePosition, ) -> Result<Self, ParseError>

Extracts a value from the given opcode.

Source

fn embed_to_opcode(&self, opcode: u8, pos: OpcodePosition) -> u8

Embeds a value in the given opcode

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl EmbeddableParam for u8

Source§

fn extract(value: u8) -> Result<u8, ParseError>

Source§

fn embed(&self) -> u8

Implementors§