pub struct Decoder { /* private fields */ }Expand description
Unified instruction decoder.
Manages the per-architecture context memory and global set. Create one
Decoder per architecture, reuse it across many decode() calls.
Implementations§
Source§impl Decoder
impl Decoder
Sourcepub fn new(arch: Architecture) -> Self
pub fn new(arch: Architecture) -> Self
Create a new decoder for the given architecture with default context.
Sourcepub fn architecture(&self) -> Architecture
pub fn architecture(&self) -> Architecture
The architecture this decoder is configured for.
Sourcepub fn decode(
&mut self,
bytes: &[u8],
addr: u64,
) -> Result<Instruction, DecodeError>
pub fn decode( &mut self, bytes: &[u8], addr: u64, ) -> Result<Instruction, DecodeError>
Decode a single instruction from bytes at virtual address addr.
Returns the decoded instruction with optimized P-code, or an error if the bytes don’t match any known encoding.
The bytes slice should contain at least enough bytes for the longest
possible instruction (15 for x86, 4 for fixed-width ISAs). Extra bytes
are ignored.
Auto Trait Implementations§
impl Freeze for Decoder
impl RefUnwindSafe for Decoder
impl Send for Decoder
impl Sync for Decoder
impl Unpin for Decoder
impl UnsafeUnpin for Decoder
impl UnwindSafe for Decoder
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