Struct mmio::VolBox[][src]

#[repr(transparent)]
#[must_use]
pub struct VolBox<T, R, W> { /* fields omitted */ }
Expand description

An owned memory location for volatile reads and writes.

Implementations

impl<T, R, W> VolBox<T, R, W>[src]

pub const unsafe fn new(loc: *mut T) -> Self[src]

Acquire ownership of a memory location.

If either R or W are Warn, this volatile box should document the additional safety requirements for Self::read/Self::read_at and Self::write/Self::write_at respectively.

Safety

Behavior is undefined if any of the following conditions are violated during the lifetime of self:

  • loc must not be aliased by any reference or read/written thru any aliased pointer.
  • loc must be valid for reads if R is not Deny.
  • loc must be valid for writes if W is not Deny.
  • loc must be properly aligned.
  • loc must point to a properly initialized value of type T if R is not Deny.

pub fn into_raw(self) -> *mut T[src]

Release ownership of the memory location.

impl<T: Copy, W> VolBox<T, Warn, W>[src]

#[must_use]
pub unsafe fn read(&self) -> T
[src]

Performs a volatile read on the owned memory location.

Safety

Please consult the documentation on self.

impl<T: Copy, W> VolBox<T, Allow, W>[src]

#[must_use]
pub fn read(&self) -> T
[src]

Performs a volatile read on the owned memory location.

impl<T: Copy, R> VolBox<T, R, Warn>[src]

pub unsafe fn write(&mut self, t: T)[src]

Performs a volatile write on the owned memory location.

Safety

Please consult the documentation on self.

impl<T: Copy, R> VolBox<T, R, Allow>[src]

pub fn write(&mut self, t: T)[src]

Performs a volatile write on the owned memory location.

impl<T: Copy, W, const N: usize> VolBox<[T; N], Warn, W>[src]

#[must_use]
pub unsafe fn read_at(&self, i: usize) -> T
[src]

Performs a volatile read on the owned memory location at a specific index.

Panics

Panics if the index is out of bounds.

Safety

Please consult the documentation on self.

impl<T: Copy, W, const N: usize> VolBox<[T; N], Allow, W>[src]

#[must_use]
pub fn read_at(&self, i: usize) -> T
[src]

Performs a volatile read on the owned memory location at a specific index.

Panics

Panics if the index is out of bounds.

impl<T: Copy, R, const N: usize> VolBox<[T; N], R, Warn>[src]

pub unsafe fn write_at(&mut self, i: usize, t: T)[src]

Performs a volatile write on the owned memory location at a specific index.

Panics

Panics if the index is out of bounds.

Safety

Please consult the documentation on self.

impl<T: Copy, R, const N: usize> VolBox<[T; N], R, Allow>[src]

pub fn write_at(&mut self, i: usize, t: T)[src]

Performs a volatile write on the owned memory location at a specific index.

Safety

Please consult the documentation on self.

Trait Implementations

impl<T: Debug, R: Debug, W: Debug> Debug for VolBox<T, R, W>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<T, R, W> Pointer for VolBox<T, R, W>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter.

impl<T: Send, R, W> Send for VolBox<T, R, W>[src]

impl<T: Sync, R, W> Sync for VolBox<T, R, W>[src]

Auto Trait Implementations

impl<T, R, W> Unpin for VolBox<T, R, W> where
    R: Unpin,
    W: Unpin

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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.

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

Performs the conversion.

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.

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

Performs the conversion.