Struct DeviceMemory

Source
pub struct DeviceMemory<'memory, RB: Integral> { /* private fields */ }
Expand description

Object containing all memory regions (we have available) of the device

Implementations§

Source§

impl<'memory, RB: Integral> DeviceMemory<'memory, RB>

Source

pub fn new() -> Self

Creates a new instance of the device memory

Source

pub fn add_memory_region<M: MemoryRegion + 'memory>(&mut self, region: M)

Adds a memory region to the device memory

Source

pub fn add_register_data<RD: RegisterData<RB> + 'memory>(&mut self, data: RD)

Adds register data to the device memory

Source

pub fn read_slice( &self, address_range: Range<u64>, ) -> Result<Option<Vec<u8>>, MemoryReadError>

Returns the slice of memory that can be found at the given address_range. If the given address range is not fully within one of the captured regions present in the device memory, then None is returned.

Source

pub fn read_u8(&self, address: u64) -> Result<Option<u8>, MemoryReadError>

Reads a byte from the given address if it is present in one of the captured regions present in the device memory

Source

pub fn read_u32( &self, address: u64, endianness: RunTimeEndian, ) -> Result<Option<u32>, MemoryReadError>

Reads a u32 from the given address if it is present in one of the captured regions present in the device memory

Source

pub fn register(&self, register: Register) -> Result<RB, MissingRegisterError>

Try to get the value of the given register. Returns an error if the register is not present in any of the register collections.

Source

pub fn register_ref( &self, register: Register, ) -> Result<&RB, MissingRegisterError>

Try to get a reference to the given register. Returns an error if the register is not present in any of the register collections.

Source

pub fn register_mut( &mut self, register: Register, ) -> Result<&mut RB, MissingRegisterError>

Try to get a mutable reference to the given register. Returns an error if the register is not present in any of the register collections.

Trait Implementations§

Source§

impl<'memory, RB: Integral> Default for DeviceMemory<'memory, RB>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'memory, RB> Freeze for DeviceMemory<'memory, RB>

§

impl<'memory, RB> !RefUnwindSafe for DeviceMemory<'memory, RB>

§

impl<'memory, RB> !Send for DeviceMemory<'memory, RB>

§

impl<'memory, RB> !Sync for DeviceMemory<'memory, RB>

§

impl<'memory, RB> Unpin for DeviceMemory<'memory, RB>

§

impl<'memory, RB> !UnwindSafe for DeviceMemory<'memory, RB>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.