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>
Available on crate feature std
only.
pub fn from_bytes(bytes: &[u8]) -> Result<Self>
std
only.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>,
Available on crate feature std
only.
pub fn from_bytes_iter<I>(bytes: I) -> Vec<Self> where
I: IntoIterator<Item = u8>,
std
only.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<'arbitrary> Arbitrary<'arbitrary> for Instruction
impl<'arbitrary> Arbitrary<'arbitrary> for Instruction
sourcefn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Generate an arbitrary value of Self
from the given unstructured data. Read more
sourcefn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
Generate an arbitrary value of Self
from the entirety of the given
unstructured data. Read more
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<'de> Deserialize<'de> for Instruction
impl<'de> Deserialize<'de> for Instruction
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<Instruction> for Opcode
impl From<Instruction> for Opcode
sourcefn from(parsed: Instruction) -> Self
fn from(parsed: Instruction) -> Self
Converts to this type from the input type.
sourceimpl From<Instruction> for u32
impl From<Instruction> for u32
sourcefn from(parsed: Instruction) -> u32
fn from(parsed: Instruction) -> u32
Converts to this type from the input type.
sourceimpl From<InstructionResult> for Instruction
impl From<InstructionResult> for Instruction
sourcefn from(r: InstructionResult) -> Self
fn from(r: InstructionResult) -> Self
Converts to this type from the input type.
sourceimpl From<Opcode> for Instruction
impl From<Opcode> for Instruction
sourceimpl From<u32> for Instruction
impl From<u32> for Instruction
sourceimpl FromIterator<Instruction> for Vec<Opcode>
Available on crate feature std
only.
impl FromIterator<Instruction> for Vec<Opcode>
std
only.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<u8>
Available on crate feature std
only.
impl FromIterator<Instruction> for Vec<u8>
std
only.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 !=
.
sourceimpl Serialize for Instruction
impl Serialize for Instruction
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 · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more