pub struct PinnedMemory<T: Copy> { /* private fields */ }Expand description
Pinned (page-locked) host memory for efficient DMA transfers.
Pinned memory allows direct DMA transfers between host and device without intermediate copying, significantly improving transfer performance.
Implementations§
Source§impl<T: Copy> PinnedMemory<T>
impl<T: Copy> PinnedMemory<T>
Sourcepub fn new(count: usize) -> Result<Self>
pub fn new(count: usize) -> Result<Self>
Allocate pinned memory for count elements.
§Safety
The underlying memory is uninitialized. Caller must ensure data is initialized before reading.
Sourcepub fn from_slice(data: &[T]) -> Result<Self>
pub fn from_slice(data: &[T]) -> Result<Self>
Create pinned memory from a slice, copying the data.
Sourcepub fn as_mut_slice(&mut self) -> &mut [T]
pub fn as_mut_slice(&mut self) -> &mut [T]
Get mutable slice reference.
Sourcepub fn as_mut_ptr(&mut self) -> *mut T
pub fn as_mut_ptr(&mut self) -> *mut T
Get mutable raw pointer.
Sourcepub fn size_bytes(&self) -> usize
pub fn size_bytes(&self) -> usize
Get size in bytes.
Trait Implementations§
Source§impl<T: Copy> Drop for PinnedMemory<T>
impl<T: Copy> Drop for PinnedMemory<T>
impl<T: Copy + Send> Send for PinnedMemory<T>
impl<T: Copy + Sync> Sync for PinnedMemory<T>
Auto Trait Implementations§
impl<T> Freeze for PinnedMemory<T>
impl<T> RefUnwindSafe for PinnedMemory<T>where
T: RefUnwindSafe,
impl<T> Unpin for PinnedMemory<T>where
T: Unpin,
impl<T> UnwindSafe for PinnedMemory<T>where
T: RefUnwindSafe + UnwindSafe,
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.