pub struct DmaAlignedRef<'a, T>(/* private fields */)
where
T: ?Sized;unstable only.Expand description
A shared reference to an InternalMemory object.
Unlike DmaAlignedMut, a DmaAlignedRef only allows reading the
value and invalidating its cache lines (discarding the CPU-cached copy so
a subsequent read observes data written by DMA). It can neither mutate the
value nor write it back, so it can be obtained from a shared borrow and used
to poll DMA-written, interior-mutable state (e.g. a descriptor’s ownership
bit) without exclusive access.
§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Implementations§
Source§impl<'a, T: ?Sized> DmaAlignedRef<'a, T>
impl<'a, T: ?Sized> DmaAlignedRef<'a, T>
Sourcepub fn new(ptr: &'a T) -> Result<Self, DmaBufError>
pub fn new(ptr: &'a T) -> Result<Self, DmaBufError>
Creates a new DmaAlignedRef from a shared reference, if it’s
provably compatible.
In internal memory, the address and size of the value must be at least 4 byte aligned.
§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Sourcepub const unsafe fn new_unchecked(ptr: &'a T) -> Self
pub const unsafe fn new_unchecked(ptr: &'a T) -> Self
Creates a new DmaAlignedRef from any shared reference.
§Safety
The caller must ensure that the reference is properly aligned for the memory region it occupies and the cachelines occupied by the reference do not overlap with any other data that can be corrupted by a cacheline invalidation operation.
§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
Sourcepub fn into_inner(self) -> &'a T
pub fn into_inner(self) -> &'a T
Converts this object into a shared reference.