pub enum DataBuffer {
Uma(Vec<u8>),
Numa((Topology, Bytes<'static>, usize)),
}Expand description
ZERO-COPY buffer abstraction for UMA and NUMA allocations
CRITICAL: This type NEVER copies data - it holds the actual memory and provides mutable slices for zero-copy operations. Python bindings access this memory directly via raw pointers.
Variants§
Uma(Vec<u8>)
UMA allocation using Vec
Numa((Topology, Bytes<'static>, usize))
NUMA allocation using hwlocality Bytes (target: 1,200-1,400 GB/s) Python accesses via Bytes’ raw pointer - ZERO COPY to Python! Stores (Topology, Bytes, actual_size) to keep Topology alive
Implementations§
Source§impl DataBuffer
impl DataBuffer
Sourcepub fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
pub fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
Get mutable slice for data generation (zero-copy)
Sourcepub fn as_mut_ptr(&mut self) -> *mut u8
pub fn as_mut_ptr(&mut self) -> *mut u8
Get mutable raw pointer for zero-copy Python access
Sourcepub fn truncate(&mut self, size: usize)
pub fn truncate(&mut self, size: usize)
Truncate to requested size (modifies metadata only, NO COPY)
Sourcepub fn into_bytes(self) -> Bytes
pub fn into_bytes(self) -> Bytes
Convert to bytes::Bytes for Python API (ZERO-COPY for UMA, minimal copy for NUMA)
For UMA: Uses Bytes::from(Vec
Auto Trait Implementations§
impl Freeze for DataBuffer
impl RefUnwindSafe for DataBuffer
impl Send for DataBuffer
impl Sync for DataBuffer
impl Unpin for DataBuffer
impl UnwindSafe for DataBuffer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more