Struct bad64::Instruction[][src]

pub struct Instruction { /* fields omitted */ }

A decoded instruction

Implementations

impl Instruction[src]

pub fn address(&self) -> u64[src]

Returns the instruction address

Example

use bad64::decode;
// nop - "\x1f\x20\x03\xd4"
let decoded = decode(0xd503201f, 0x1000).unwrap();
assert_eq!(decoded.address(), 0x1000);

pub fn opcode(&self) -> u32[src]

Returns the instruction opcode

Example

use bad64::decode;
// nop - "\x1f\x20\x03\xd4"
let decoded = decode(0xd503201f, 0x1000).unwrap();
assert_eq!(decoded.opcode(), 0xd503201f);

pub fn op(&self) -> Op[src]

Returns the instruction operation

Example

use bad64::{decode, Op};
// nop - "\x1f\x20\x03\xd4"
let decoded = decode(0xd503201f, 0x1000).unwrap();
assert_eq!(decoded.op(), Op::NOP);

pub fn operands(&self) -> &[Operand][src]

Returns a slice of Operands

Example

use bad64::{decode, Operand, Reg};

// eor x0, x1, x2  - "\x20\x00\x02\xca"
let decoded = decode(0xca020020, 0x1000).unwrap();

let mut ops = decoded.operands();

assert_eq!(ops.len(), 3);
assert_eq!(ops[0], Operand::Reg { reg: Reg::X0, arrspec: None });
assert_eq!(ops[1], Operand::Reg { reg: Reg::X1, arrspec: None });
assert_eq!(ops[2], Operand::Reg { reg: Reg::X2, arrspec: None });

Trait Implementations

impl Clone for Instruction[src]

impl Debug for Instruction[src]

impl Display for Instruction[src]

impl Eq for Instruction[src]

impl Hash for Instruction[src]

impl PartialEq<Instruction> for Instruction[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.