Struct fuel_vm::prelude::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 new(instruction: u32) -> Instruction
pub const fn new(instruction: u32) -> Instruction
Extracts fields from a raw instruction
sourcepub unsafe fn from_slice_unchecked(buf: &[u8]) -> Instruction
pub unsafe fn from_slice_unchecked(buf: &[u8]) -> Instruction
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: u64) -> (Instruction, Instruction)
pub const fn parse_word(word: u64) -> (Instruction, Instruction)
Splits a Word into two Instruction
that can be used to construct crate::Opcode
sourcepub const fn into_inner(self) -> (OpcodeRepr, usize, usize, usize, usize, u64)
pub const fn into_inner(self) -> (OpcodeRepr, usize, usize, usize, usize, u64)
Convert the instruction into its internal representation
(repr, $ra, $rb, $rc, $rd, immediate)
sourceimpl Instruction
impl Instruction
sourcepub fn from_bytes(bytes: &[u8]) -> Result<Instruction, Error>
pub fn from_bytes(bytes: &[u8]) -> Result<Instruction, Error>
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<Instruction, Global> where
I: IntoIterator<Item = u8>,
pub fn from_bytes_iter<I>(bytes: I) -> Vec<Instruction, Global> 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<'de> Deserialize<'de> for Instruction
impl<'de> Deserialize<'de> for Instruction
sourcefn deserialize<__D>(
__deserializer: __D
) -> Result<Instruction, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Instruction, <__D as Deserializer<'de>>::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
sourceimpl From<InstructionResult> for Instruction
impl From<InstructionResult> for Instruction
sourcefn from(r: InstructionResult) -> Instruction
fn from(r: InstructionResult) -> Instruction
Converts to this type from the input type.
sourceimpl From<Opcode> for Instruction
impl From<Opcode> for Instruction
sourcefn from(op: Opcode) -> Instruction
fn from(op: Opcode) -> Instruction
Converts to this type from the input type.
sourceimpl From<u32> for Instruction
impl From<u32> for Instruction
sourcefn from(instruction: u32) -> Instruction
fn from(instruction: u32) -> Instruction
Converts to this type from the input type.
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
sourcefn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
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
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.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more