pub struct MemoryOpcode { /* private fields */ }Expand description
Represents a full memory opcode: class, size, mode.
Implementations§
Source§impl MemoryOpcode
impl MemoryOpcode
Sourcepub fn get_class(&self) -> &OpcodeClass
pub fn get_class(&self) -> &OpcodeClass
Returns the opcode’s class.
§Example
use bpf_ins::{Instruction, Opcode, OpcodeClass, Register};
let instruction = Instruction::storex64(Register::R1, 0, Register::R2);
let opcode = instruction.get_opcode();
assert!(matches!(opcode, Opcode::Memory(_)));
if let Opcode::Memory(memory) = opcode {
assert!(matches!(memory.get_class(), OpcodeClass::StoreReg));
}Sourcepub fn get_size(&self) -> &MemoryOpSize
pub fn get_size(&self) -> &MemoryOpSize
Returns the memory operation size.
§Example
use bpf_ins::{Instruction, MemoryOpSize, Opcode, Register};
let instruction = Instruction::storex64(Register::R1, 0, Register::R2);
let opcode = instruction.get_opcode();
assert!(matches!(opcode, Opcode::Memory(_)));
if let Opcode::Memory(memory) = opcode {
assert!(matches!(memory.get_size(), MemoryOpSize::DoubleWord));
}Sourcepub fn get_mode(&self) -> &MemoryOpMode
pub fn get_mode(&self) -> &MemoryOpMode
Returns the memory operation mode.
§Example
use bpf_ins::{Instruction, MemoryOpMode, Opcode, Register};
let instruction = Instruction::storex64(Register::R1, 0, Register::R2);
let opcode = instruction.get_opcode();
assert!(matches!(opcode, Opcode::Memory(_)));
if let Opcode::Memory(memory) = opcode {
assert!(matches!(memory.get_mode(), MemoryOpMode::Memory));
}Trait Implementations§
Source§impl Clone for MemoryOpcode
impl Clone for MemoryOpcode
Source§fn clone(&self) -> MemoryOpcode
fn clone(&self) -> MemoryOpcode
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 MemoryOpcode
impl Debug for MemoryOpcode
Source§impl Ord for MemoryOpcode
impl Ord for MemoryOpcode
Source§fn cmp(&self, other: &MemoryOpcode) -> Ordering
fn cmp(&self, other: &MemoryOpcode) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for MemoryOpcode
impl PartialEq for MemoryOpcode
Source§impl PartialOrd for MemoryOpcode
impl PartialOrd for MemoryOpcode
impl Copy for MemoryOpcode
impl Eq for MemoryOpcode
impl StructuralPartialEq for MemoryOpcode
Auto Trait Implementations§
impl Freeze for MemoryOpcode
impl RefUnwindSafe for MemoryOpcode
impl Send for MemoryOpcode
impl Sync for MemoryOpcode
impl Unpin for MemoryOpcode
impl UnwindSafe for MemoryOpcode
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