#[repr(transparent)]
#[must_use]
pub struct VolBox<T, R, W> { /* fields omitted */ }
Expand description
An owned memory location for volatile reads and writes.
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.
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
.
Release ownership of the memory location.
#[must_use]
pub unsafe fn read(&self) -> T
[src]
Performs a volatile read on the owned memory location.
Please consult the documentation on self
.
#[must_use]
pub fn read(&self) -> T
[src]
Performs a volatile read on the owned memory location.
pub unsafe fn write(&mut self, t: T)
[src]
Performs a volatile write on the owned memory location.
Please consult the documentation on self
.
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 if the index is out of bounds.
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 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 if the index is out of bounds.
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.
Please consult the documentation on self
.
Formats the value using the given formatter. Read more
Formats the value using the given formatter.
impl<T> Any for T where
T: 'static + ?Sized,
[src]
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
impl<T, U> Into<U> for T where
U: From<T>,
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
The type returned in the event of a conversion error.
The type returned in the event of a conversion error.