Struct evegfx::memory::Ptr[][src]

pub struct Ptr<R: MemoryRegion> { /* fields omitted */ }

A pointer to a memory address within a particular memory region identified by type parameter R.

Pointers are parameterized by memory region so that other parts of this library which consume pointers can statically constrain what memory regions they are able to refer to.

Implementations

impl<R: MemoryRegion> Ptr<R>[src]

General API for pointers across all memory regions.

pub fn new(offset: u32) -> Self[src]

Constructs a new pointer from the given raw address.

Note that a pointer always belongs to a memory region, but there's no argument here to select one. Instead, we typically rely on type inference to select one, by using the result in a context which implies a particular memory region.

The given offset is interpreted as an offset into the selected memory region, modulo the region length. See MemoryRegion::ptr for more information.

pub fn to_raw(self) -> u32[src]

Returns the absolute address of the pointer.

pub fn to_raw_offset(self) -> u32[src]

Returns the offset of the pointer relative to its containing memory region.

pub fn slice_length(self, length: u32) -> Slice<R>[src]

Returns a slice whose base address is the pointer and whose length is given as an argument.

impl<R: MemoryRegion + HostAccessible> Ptr<R>[src]

pub fn build_spi_write_header(self, into: &mut [u8; 3])[src]

Write the three bytes needed to form a "write memory" header for the address into the given bytes. This is a helper for physical implementations that need to construct a message buffer to transmit to the real chip, e.g. via SPI.

pub fn build_spi_read_header(self, into: &mut [u8; 4])[src]

Write the four bytes needed to form a "read memory" header for the address into the given bytes. This is a helper for physical implementations that need to construct a message buffer to transmit to the real chip, e.g. via SPI.

Trait Implementations

impl<R: MemoryRegion> Add<i32> for Ptr<R>[src]

type Output = Self

The resulting type after applying the + operator.

impl<R: MemoryRegion> Add<u32> for Ptr<R>[src]

type Output = Self

The resulting type after applying the + operator.

impl<R: MemoryRegion> AddAssign<i32> for Ptr<R>[src]

impl<R: MemoryRegion> AddAssign<u32> for Ptr<R>[src]

impl<R: Clone + MemoryRegion> Clone for Ptr<R>[src]

impl<R: Copy + MemoryRegion> Copy for Ptr<R>[src]

impl<R: MemoryRegion> Debug for Ptr<R>[src]

impl<R: MemoryRegion> Display for Ptr<R>[src]

impl<R: MemoryRegion> Eq for Ptr<R>[src]

impl<R: MemoryRegion> Ord for Ptr<R>[src]

impl<R1: MemoryRegion, R2: MemoryRegion<Model = R1::Model>> PartialEq<Ptr<R2>> for Ptr<R1>[src]

impl<R1: MemoryRegion, R2: MemoryRegion<Model = R1::Model>> PartialOrd<Ptr<R2>> for Ptr<R1>[src]

impl<R: MemoryRegion> Sub<i32> for Ptr<R>[src]

type Output = Self

The resulting type after applying the - operator.

impl<R: MemoryRegion> Sub<u32> for Ptr<R>[src]

type Output = Self

The resulting type after applying the - operator.

impl<R: MemoryRegion> SubAssign<i32> for Ptr<R>[src]

impl<R: MemoryRegion> SubAssign<u32> for Ptr<R>[src]

Auto Trait Implementations

impl<R> Send for Ptr<R> where
    R: Send
[src]

impl<R> Sync for Ptr<R> where
    R: Sync
[src]

impl<R> Unpin for Ptr<R> where
    R: Unpin
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.