BytePointer

Trait BytePointer 

Source
pub trait BytePointer {
    // Required methods
    fn addr(&self, offset: usize) -> *mut u8;
    fn ptr(&self) -> *mut u8;
    fn len(&self) -> usize;

    // Provided method
    fn dump(&self, file: &str) -> Result<()> { ... }
}
Expand description

Trait for accessing memory as a byte pointer.

Provides low-level access to memory regions with byte-level addressing.

Required Methods§

Source

fn addr(&self, offset: usize) -> *mut u8

Returns a mutable pointer to the byte at the given offset.

§Safety

The returned pointer is valid only while the memory region exists. Dereferencing requires unsafe code and proper synchronization.

Source

fn ptr(&self) -> *mut u8

Returns a mutable pointer to the start of the memory region.

Source

fn len(&self) -> usize

Returns the total length of the memory region in bytes.

Provided Methods§

Source

fn dump(&self, file: &str) -> Result<()>

Dumps memory contents to a file in hexadecimal format.

Writes each row (8KB) as a line of hexadecimal bytes.

§Errors

Returns an error if file creation or writing fails.

Implementors§