Union volatile_mem::Volatile [−][src]
Volatile data or memory.
See crate-level documentation for details.
Implementations
impl<T: Copy, P> Volatile<T, P>
[src]
pub unsafe fn from_ptr<'a>(mem: *const T) -> &'a Self
[src]
Converts a pointer to T
into a reference to Volatile<T>
, which can
be read-only, write-only, or
both readable and writable (the default).
Safety
Behavior is undefined if any of the following conditions are violated:
-
mem
must be valid for reads and/or writes. -
mem
must be properly aligned. -
mem
must point to a properly initialized value of typeT
(unless the resultingVolatile<T>
is write-only).
Note that even if T
has size zero, the pointer must be non-NULL and
properly aligned.
Just like in C, whether an operation is volatile has no bearing whatsoever on questions involving concurrent access from multiple threads. Volatile accesses behave exactly like non-atomic accesses in that regard. In particular, a race between a write operation any other operation (reading or writing) to the same location is undefined behavior.
pub unsafe fn from_mut_ptr<'a>(mem: *mut T) -> &'a mut Self
[src]
Converts a mutable pointer to T
into a mutable reference to
Volatile<T>
, which can be read-only,
write-only, or both readable and writable (the
default).
Safety
Behavior is undefined if any of the following conditions are violated:
-
mem
must be valid for reads and/or writes. -
mem
must be properly aligned. -
mem
must point to a properly initialized value of typeT
(unless the resultingVolatile<T>
is write-only).
Note that even if T
has size zero, the pointer must be non-NULL and
properly aligned.
pub fn from_ref<'a>(mem: &T) -> &'a Self
[src]
Converts a shared reference to T
into a shared reference to
Volatile<T>
, which can be read-only,
write-only, or both readable and writable (the
default).
pub fn from_mut<'a>(mem: &mut T) -> &'a mut Self
[src]
Converts a mutable reference to T
into a mutable reference to
Volatile<T>
, which can be read-only,
write-only, or both readable and writable (the
default).
Trait Implementations
impl<T: Copy, P, const N: usize> AsMut<[Volatile<T, P>]> for Volatile<[T; N], P>
[src]
impl<T: Copy, P, const N: usize> AsRef<[Volatile<T, P>]> for Volatile<[T; N], P>
[src]
impl<T: Copy, P, const N: usize> Borrow<[Volatile<T, P>]> for Volatile<[T; N], P>
[src]
impl<T: Copy, P, const N: usize> BorrowMut<[Volatile<T, P>]> for Volatile<[T; N], P>
[src]
fn borrow_mut(&mut self) -> &mut [Volatile<T, P>]
[src]
impl<T: Copy, P> Debug for Volatile<T, P>
[src]
impl<T: Copy, P, const N: usize> Deref for Volatile<[T; N], P>
[src]
type Target = [Volatile<T, P>]
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
impl<T: Copy, P, const N: usize> DerefMut for Volatile<[T; N], P>
[src]
impl<'a, T: Copy, P> From<&'a T> for &'a Volatile<T, P>
[src]
impl<'a, T: Copy, P> From<&'a mut T> for &'a mut Volatile<T, P>
[src]
impl<T: Copy, P> VolatileData<T> for Volatile<T, P>
[src]
impl<T: Copy, P: Read> VolatileRead<T> for Volatile<T, P>
[src]
fn read(&self) -> T
[src]
Performs a volatile read of the value in self
without moving it. This
leaves the memory in self
unchanged.
impl<T: Copy, P: Write> VolatileWrite<T> for Volatile<T, P>
[src]
Auto Trait Implementations
impl<T, Permission> Send for Volatile<T, Permission> where
Permission: Send,
T: Send,
Permission: Send,
T: Send,
impl<T, Permission> Sync for Volatile<T, Permission> where
Permission: Sync,
T: Sync,
Permission: Sync,
T: Sync,
impl<T, Permission> Unpin for Volatile<T, Permission> where
Permission: Unpin,
T: Unpin,
Permission: Unpin,
T: 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>,
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]
impl<S, T, U> VolatileReadSlice<T, U> for S where
T: VolatileRead<U>,
U: Copy,
S: AsRef<[T]>,
[src]
T: VolatileRead<U>,
U: Copy,
S: AsRef<[T]>,
fn read_slice_volatile(&self, dst: &mut [U])
[src]
impl<S, T, U> VolatileWriteSlice<T, U> for S where
T: VolatileWrite<U>,
U: Copy,
S: AsMut<[T]>,
[src]
T: VolatileWrite<U>,
U: Copy,
S: AsMut<[T]>,