Trait MemoryReadExt

Source
pub trait MemoryReadExt: MemoryRead {
    // Provided methods
    fn try_read<T: Pod>(&self, address: u64) -> Option<T> { ... }
    unsafe fn try_read_unchecked<T>(&self, address: u64) -> Option<T> { ... }
    fn read<T: Pod>(&self, address: u64) -> T { ... }
    fn try_read_bytes_const<const LEN: usize>(
        &self,
        address: u64,
    ) -> Option<[u8; LEN]> { ... }
    fn try_read_bytes_into_chunked<const CHUNK_SIZE: usize>(
        &self,
        address: u64,
        buf: &mut [u8],
    ) -> Option<()> { ... }
    fn try_read_bytes_into_chunked_fallible<const CHUNK_SIZE: usize>(
        &self,
        address: u64,
        buf: &mut [u8],
    ) -> Option<usize> { ... }
}
Expand description

Extension trait for supplying generic util methods for MemoryRead

Provided Methods§

Source

fn try_read<T: Pod>(&self, address: u64) -> Option<T>

Reads bytes from the process at the specified address into a value of type T. Returns None if the address is not valid

Source

unsafe fn try_read_unchecked<T>(&self, address: u64) -> Option<T>

Reads any type T from the process without the restriction of Pod

Source

fn read<T: Pod>(&self, address: u64) -> T

Reads bytes from the process at the specified address into a value of type T. Panics if the address is not valid

Source

fn try_read_bytes_const<const LEN: usize>( &self, address: u64, ) -> Option<[u8; LEN]>

Reads a const number of bytes from the process returning a stack allocated array.

Source

fn try_read_bytes_into_chunked<const CHUNK_SIZE: usize>( &self, address: u64, buf: &mut [u8], ) -> Option<()>

Reads bytes from the process in chunks with the specified size

Source

fn try_read_bytes_into_chunked_fallible<const CHUNK_SIZE: usize>( &self, address: u64, buf: &mut [u8], ) -> Option<usize>

Reads bytes from the process in chunks with the specified size. The function will return Some(n) with the number of bytes read unless every single chunk fails

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§