pub enum EncoderOperand {
None,
Reg(Register),
Mem(MemoryOperand),
Imm(u64),
Rel(i32),
}Expand description
Operand for encoding
Represents the different types of operands that can be used when encoding instructions.
Variants§
None
No operand (placeholder)
Reg(Register)
Register operand
Mem(MemoryOperand)
Memory operand
Imm(u64)
Unsigned immediate value
Rel(i32)
Signed relative offset (for branches)
Implementations§
Source§impl EncoderOperand
impl EncoderOperand
Sourcepub const fn mem(memory: MemoryOperand) -> Self
pub const fn mem(memory: MemoryOperand) -> Self
Create a memory operand
Sourcepub const fn is_register(&self) -> bool
pub const fn is_register(&self) -> bool
Check if this is a register operand
Sourcepub const fn is_immediate(&self) -> bool
pub const fn is_immediate(&self) -> bool
Check if this is an immediate operand
Sourcepub const fn is_relative(&self) -> bool
pub const fn is_relative(&self) -> bool
Check if this is a relative offset operand
Sourcepub const fn as_register(&self) -> Option<Register>
pub const fn as_register(&self) -> Option<Register>
Get the register if this is a register operand
Sourcepub const fn as_memory(&self) -> Option<&MemoryOperand>
pub const fn as_memory(&self) -> Option<&MemoryOperand>
Get the memory operand if this is a memory operand
Sourcepub const fn as_immediate(&self) -> Option<u64>
pub const fn as_immediate(&self) -> Option<u64>
Get the immediate value if this is an immediate operand
Sourcepub const fn as_relative(&self) -> Option<i32>
pub const fn as_relative(&self) -> Option<i32>
Get the relative offset if this is a relative operand
Trait Implementations§
Source§impl Clone for EncoderOperand
impl Clone for EncoderOperand
Source§fn clone(&self) -> EncoderOperand
fn clone(&self) -> EncoderOperand
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EncoderOperand
impl Debug for EncoderOperand
Source§impl Default for EncoderOperand
impl Default for EncoderOperand
Source§fn default() -> EncoderOperand
fn default() -> EncoderOperand
Returns the “default value” for a type. Read more
Source§impl PartialEq for EncoderOperand
impl PartialEq for EncoderOperand
impl Copy for EncoderOperand
impl Eq for EncoderOperand
impl StructuralPartialEq for EncoderOperand
Auto Trait Implementations§
impl Freeze for EncoderOperand
impl RefUnwindSafe for EncoderOperand
impl Send for EncoderOperand
impl Sync for EncoderOperand
impl Unpin for EncoderOperand
impl UnsafeUnpin for EncoderOperand
impl UnwindSafe for EncoderOperand
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more