Struct PinnedMemory
pub struct PinnedMemory<T>where
T: Copy,{
ptr: NonNull<T>,
len: usize,
layout: Layout,
_marker: PhantomData<T>,
}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.
Fields§
§ptr: NonNull<T>§len: usize§layout: Layout§_marker: PhantomData<T>Implementations§
§impl<T> PinnedMemory<T>where
T: Copy,
impl<T> PinnedMemory<T>where
T: Copy,
pub fn new(count: usize) -> Result<PinnedMemory<T>, RingKernelError>
pub fn new(count: usize) -> Result<PinnedMemory<T>, RingKernelError>
Allocate pinned memory for count elements.
§Safety
The underlying memory is uninitialized. Caller must ensure data is initialized before reading.
pub fn from_slice(data: &[T]) -> Result<PinnedMemory<T>, RingKernelError>
pub fn from_slice(data: &[T]) -> Result<PinnedMemory<T>, RingKernelError>
Create pinned memory from a slice, copying the data.
pub fn as_mut_slice(&mut self) -> &mut [T]
pub fn as_mut_slice(&mut self) -> &mut [T]
Get mutable slice reference.
pub fn as_mut_ptr(&mut self) -> *mut T
pub fn as_mut_ptr(&mut self) -> *mut T
Get mutable raw pointer.
pub fn size_bytes(&self) -> usize
pub fn size_bytes(&self) -> usize
Get size in bytes.
Trait Implementations§
§impl<T> Drop for PinnedMemory<T>where
T: Copy,
impl<T> Drop for PinnedMemory<T>where
T: Copy,
impl<T> Send for PinnedMemory<T>
impl<T> 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§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§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
§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
§fn deserialize(
&self,
deserializer: &mut D,
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>
Deserializes using the given deserializer
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§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.