pub trait CopyAddress {
    // Required methods
    fn copy_address(&self, addr: usize, buf: &mut [u8]) -> Result<(), Error>;
    fn get_pointer_width(&self) -> Architecture;

    // Provided method
    fn get_offset(&self, offsets: &[usize]) -> Result<usize, Error> { ... }
}
Expand description

A trait that defines that it is possible to copy some memory from something represented by a type into a buffer.

Required Methods§

fn copy_address(&self, addr: usize, buf: &mut [u8]) -> Result<(), Error>

Copy an address into user-defined buffer.

Errors

std::io::Error if an error occurs copying the address.

fn get_pointer_width(&self) -> Architecture

Get the the pointer width of the underlying process. This is required for get_offset to work.

Performance

Any implementation of this function should be marked with #[inline(always)] as this function is very commonly called and should be inlined.

Provided Methods§

fn get_offset(&self, offsets: &[usize]) -> Result<usize, Error>

Get the actual memory location from a set of offsets.

If copy_address and get_pointer_width are already defined, then we can provide a standard implementation that will work across all operating systems.

Errors

std::io::Error if an error occurs copying the address.

Implementations on Foreign Types§

§

impl CopyAddress for (i32, Architecture)

§

fn get_pointer_width(&self) -> Architecture

§

fn copy_address(&self, addr: usize, buf: &mut [u8]) -> Result<(), Error>

Implementors§