Struct fuel_asm::Instruction
source · [−]pub struct Instruction { /* private fields */ }
Expand description
A version of Opcode that can used without unnecessary branching
Implementations
sourceimpl Instruction
impl Instruction
sourcepub const fn ra(&self) -> RegisterId
pub const fn ra(&self) -> RegisterId
Register A
sourcepub const fn rb(&self) -> RegisterId
pub const fn rb(&self) -> RegisterId
Register B
sourcepub const fn rc(&self) -> RegisterId
pub const fn rc(&self) -> RegisterId
Register C
sourcepub const fn rd(&self) -> RegisterId
pub const fn rd(&self) -> RegisterId
Register D
sourcepub const fn imm06(&self) -> Immediate06
pub const fn imm06(&self) -> Immediate06
Immediate with 6 bits
sourcepub const fn imm12(&self) -> Immediate12
pub const fn imm12(&self) -> Immediate12
Immediate with 12 bits
sourcepub const fn imm18(&self) -> Immediate18
pub const fn imm18(&self) -> Immediate18
Immediate with 18 bits
sourcepub const fn imm24(&self) -> Immediate24
pub const fn imm24(&self) -> Immediate24
Immediate with 24 bits
sourcepub unsafe fn from_slice_unchecked(buf: &[u8]) -> Self
pub unsafe fn from_slice_unchecked(buf: &[u8]) -> Self
Create a Instruction
from a slice of bytes
Safety
The caller must ensure that the slice is has at least Self::LEN
bytes.
sourcepub const fn parse_word(word: Word) -> (Instruction, Instruction)
pub const fn parse_word(word: Word) -> (Instruction, Instruction)
Splits a Word into two Instruction
that can be used to construct crate::Opcode
sourcepub const fn into_inner(
self
) -> (OpcodeRepr, RegisterId, RegisterId, RegisterId, RegisterId, Word)
pub const fn into_inner(
self
) -> (OpcodeRepr, RegisterId, RegisterId, RegisterId, RegisterId, Word)
Convert the instruction into its internal representation
(repr, $ra, $rb, $rc, $rd, immediate)
sourceimpl Instruction
impl Instruction
sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self>
pub fn from_bytes(bytes: &[u8]) -> Result<Self>
Create a Instruction
from a slice of bytes
This function will fail if the length of the bytes is smaller than
Instruction::LEN
.
sourcepub fn from_bytes_iter<I>(bytes: I) -> Vec<Self> where
I: IntoIterator<Item = u8>,
pub fn from_bytes_iter<I>(bytes: I) -> Vec<Self> where
I: IntoIterator<Item = u8>,
Create a set of Instruction
from an iterator of bytes
If not padded to Self::LEN
, will consume the unaligned bytes but won’t try to parse an
instruction from them.
Trait Implementations
sourceimpl Clone for Instruction
impl Clone for Instruction
sourcefn clone(&self) -> Instruction
fn clone(&self) -> Instruction
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for Instruction
impl Debug for Instruction
sourceimpl Default for Instruction
impl Default for Instruction
sourcefn default() -> Instruction
fn default() -> Instruction
Returns the “default value” for a type. Read more
sourceimpl From<Instruction> for u32
impl From<Instruction> for u32
sourcefn from(parsed: Instruction) -> u32
fn from(parsed: Instruction) -> u32
Performs the conversion.
sourceimpl From<Instruction> for Opcode
impl From<Instruction> for Opcode
sourcefn from(parsed: Instruction) -> Self
fn from(parsed: Instruction) -> Self
Performs the conversion.
sourceimpl From<InstructionResult> for Instruction
impl From<InstructionResult> for Instruction
sourcefn from(r: InstructionResult) -> Self
fn from(r: InstructionResult) -> Self
Performs the conversion.
sourceimpl FromIterator<Instruction> for Vec<u8>
impl FromIterator<Instruction> for Vec<u8>
sourcefn from_iter<T>(iter: T) -> Self where
T: IntoIterator<Item = Instruction>,
fn from_iter<T>(iter: T) -> Self where
T: IntoIterator<Item = Instruction>,
Creates a value from an iterator. Read more
sourceimpl FromIterator<Instruction> for Vec<Opcode>
impl FromIterator<Instruction> for Vec<Opcode>
sourcefn from_iter<T>(iter: T) -> Self where
T: IntoIterator<Item = Instruction>,
fn from_iter<T>(iter: T) -> Self where
T: IntoIterator<Item = Instruction>,
Creates a value from an iterator. Read more
sourceimpl Hash for Instruction
impl Hash for Instruction
sourceimpl PartialEq<Instruction> for Instruction
impl PartialEq<Instruction> for Instruction
sourcefn eq(&self, other: &Instruction) -> bool
fn eq(&self, other: &Instruction) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &Instruction) -> bool
fn ne(&self, other: &Instruction) -> bool
This method tests for !=
.
impl Copy for Instruction
impl Eq for Instruction
impl StructuralEq for Instruction
impl StructuralPartialEq for Instruction
Auto Trait Implementations
impl RefUnwindSafe for Instruction
impl Send for Instruction
impl Sync for Instruction
impl Unpin for Instruction
impl UnwindSafe for Instruction
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more