Struct evegfx::memory::Ptr [−][src]
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.
fn add(self, offset: i32) -> Self
[src]
impl<R: MemoryRegion> Add<u32> for Ptr<R>
[src]
type Output = Self
The resulting type after applying the +
operator.
fn add(self, offset: u32) -> Self
[src]
impl<R: MemoryRegion> AddAssign<i32> for Ptr<R>
[src]
fn add_assign(&mut self, offset: i32)
[src]
impl<R: MemoryRegion> AddAssign<u32> for Ptr<R>
[src]
fn add_assign(&mut self, offset: u32)
[src]
impl<R: Clone + MemoryRegion> Clone for Ptr<R>
[src]
fn clone(&self) -> Ptr<R>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[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]
fn cmp(&self, other: &Ptr<R>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<R1: MemoryRegion, R2: MemoryRegion<Model = R1::Model>> PartialEq<Ptr<R2>> for Ptr<R1>
[src]
fn eq(&self, other: &Ptr<R2>) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<R1: MemoryRegion, R2: MemoryRegion<Model = R1::Model>> PartialOrd<Ptr<R2>> for Ptr<R1>
[src]
fn partial_cmp(&self, other: &Ptr<R2>) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<R: MemoryRegion> Sub<i32> for Ptr<R>
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, offset: i32) -> Self
[src]
impl<R: MemoryRegion> Sub<u32> for Ptr<R>
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, offset: u32) -> Self
[src]
impl<R: MemoryRegion> SubAssign<i32> for Ptr<R>
[src]
fn sub_assign(&mut self, offset: i32)
[src]
impl<R: MemoryRegion> SubAssign<u32> for Ptr<R>
[src]
fn sub_assign(&mut self, offset: u32)
[src]
Auto Trait Implementations
impl<R> Send for Ptr<R> where
R: Send,
[src]
R: Send,
impl<R> Sync for Ptr<R> where
R: Sync,
[src]
R: Sync,
impl<R> Unpin for Ptr<R> where
R: Unpin,
[src]
R: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,