Skip to main content

Instruction

Struct Instruction 

Source
pub struct Instruction(/* private fields */);
Expand description

Zero-cost abstraction for Lua 5.5 instruction encoding Internally stores a 32-bit instruction following Lua 5.5 format

Implementations§

Source§

impl Instruction

Source

pub const SIZE_OP: u32 = 7

Source

pub const SIZE_A: u32 = 8

Source

pub const SIZE_B: u32 = 8

Source

pub const SIZE_C: u32 = 8

Source

pub const SIZE_K: u32 = 1

Source

pub const SIZE_V_B: u32 = 6

Source

pub const SIZE_V_C: u32 = 10

Source

pub const SIZE_BX: u32

Source

pub const SIZE_AX: u32

Source

pub const SIZE_SJ: u32

Source

pub const POS_OP: u32 = 0

Source

pub const POS_A: u32

Source

pub const POS_K: u32

Source

pub const POS_B: u32

Source

pub const POS_C: u32

Source

pub const POS_V_B: u32

Source

pub const POS_V_C: u32

Source

pub const POS_BX: u32 = Self::POS_K

Source

pub const POS_AX: u32 = Self::POS_A

Source

pub const POS_SJ: u32 = Self::POS_A

Source

pub const MAX_A: u32

Source

pub const MAX_B: u32

Source

pub const MAX_C: u32

Source

pub const MAX_V_B: u32

Source

pub const MAX_V_C: u32

Source

pub const MAX_BX: u32

Source

pub const MAX_AX: u32

Source

pub const MAX_SJ: u32

Source

pub const OFFSET_SB: i32

Source

pub const OFFSET_SC: i32

Source

pub const OFFSET_SBX: i32

Source

pub const OFFSET_SJ: i32

Source

pub const fn from_u32(value: u32) -> Self

Create an Instruction from a raw u32 value

Source

pub const fn as_u32(self) -> u32

Get the raw u32 value of this instruction

Source

pub fn get_opcode(self) -> OpCode

Source

pub fn set_opcode(&mut self, op: OpCode)

Source

pub fn get_a(self) -> u32

Source

pub fn set_a(&mut self, v: u32)

Source

pub fn get_b(self) -> u32

Source

pub fn get_sb(self) -> i32

Source

pub fn set_b(&mut self, v: u32)

Source

pub fn get_c(self) -> u32

Source

pub fn get_sc(self) -> i32

Source

pub fn set_c(&mut self, v: u32)

Source

pub fn get_k(self) -> bool

Source

pub fn set_k(&mut self, v: bool)

Source

pub fn get_bx(self) -> u32

Source

pub fn get_sbx(self) -> i32

Source

pub fn set_bx(&mut self, v: u32)

Source

pub fn get_ax(self) -> u32

Source

pub fn set_ax(&mut self, v: u32)

Source

pub fn get_sj(self) -> i32

Source

pub fn set_sj(&mut self, v: i32)

Source

pub fn get_vb(self) -> u32

Source

pub fn get_vc(self) -> u32

Source

pub fn create_abc(op: OpCode, a: u32, b: u32, c: u32) -> Self

Source

pub fn create_abck(op: OpCode, a: u32, b: u32, c: u32, k: bool) -> Self

Source

pub fn create_vabck(op: OpCode, a: u32, b: u32, c: u32, k: bool) -> Self

Source

pub fn create_abx(op: OpCode, a: u32, bx: u32) -> Self

Source

pub fn create_asbx(op: OpCode, a: u32, sbx: i32) -> Self

Source

pub fn create_ax(op: OpCode, ax: u32) -> Self

Source

pub fn create_sj(op: OpCode, sj: i32) -> Self

Source

pub fn is_k(x: u32) -> bool

Source

pub fn rk_index(x: u32) -> u32

Source

pub fn encode_abc(op: OpCode, a: u32, b: u32, c: u32) -> Self

Source

pub fn encode_abck(op: OpCode, a: u32, b: u32, c: u32, k: u32) -> Self

Source

pub fn encode_abx(op: OpCode, a: u32, bx: u32) -> Self

Source

pub fn encode_asbx(op: OpCode, a: u32, sbx: i32) -> Self

Trait Implementations§

Source§

impl Clone for Instruction

Source§

fn clone(&self) -> Instruction

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Instruction

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Instruction

Source§

fn eq(&self, other: &Instruction) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Instruction

Source§

impl Eq for Instruction

Source§

impl StructuralPartialEq for Instruction

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> LuaMethodProvider for T

Source§

impl<T> LuaStaticMethodProvider for T

Source§

fn __lua_static_methods() -> &'static [(&'static str, CFunction)]

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.