pub struct AlignedBuffer { /* private fields */ }Expand description
SIMD-aligned buffer with metadata
This buffer guarantees proper alignment for SIMD operations using direct memory allocation. It supports SSE (16-byte), AVX2 (32-byte), and AVX-512 (64-byte) alignments.
Implementations§
Source§impl AlignedBuffer
impl AlignedBuffer
Sourcepub fn new(capacity: usize, alignment: usize) -> DomainResult<Self>
pub fn new(capacity: usize, alignment: usize) -> DomainResult<Self>
Sourcepub fn new_sse(capacity: usize) -> DomainResult<Self>
pub fn new_sse(capacity: usize) -> DomainResult<Self>
Create an aligned buffer with specific SIMD level
Sourcepub fn new_avx2(capacity: usize) -> DomainResult<Self>
pub fn new_avx2(capacity: usize) -> DomainResult<Self>
Create an aligned buffer for AVX2 operations
Sourcepub fn new_avx512(capacity: usize) -> DomainResult<Self>
pub fn new_avx512(capacity: usize) -> DomainResult<Self>
Create an aligned buffer for AVX-512 operations
Sourcepub fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
pub fn as_mut_slice(&mut self) -> &mut [u8] ⓘ
Get mutable slice to buffer data
Sourcepub fn as_mut_capacity_slice(&mut self) -> &mut [u8] ⓘ
pub fn as_mut_capacity_slice(&mut self) -> &mut [u8] ⓘ
Get a mutable slice with full capacity
Sourcepub fn reserve(&mut self, additional: usize) -> DomainResult<()>
pub fn reserve(&mut self, additional: usize) -> DomainResult<()>
Reserve additional capacity
Sourcepub fn extend_from_slice(&mut self, data: &[u8]) -> DomainResult<()>
pub fn extend_from_slice(&mut self, data: &[u8]) -> DomainResult<()>
Push bytes to the buffer
Sourcepub fn as_mut_ptr(&mut self) -> *mut u8
pub fn as_mut_ptr(&mut self) -> *mut u8
Get the mutable raw pointer to the buffer
Sourcepub fn is_aligned(&self) -> bool
pub fn is_aligned(&self) -> bool
Check if buffer is properly aligned
This validates that the buffer pointer has the requested alignment, which is critical for SIMD operations.
Sourcepub fn actual_alignment(&self) -> usize
pub fn actual_alignment(&self) -> usize
Get the actual alignment of the buffer
Sourcepub fn is_simd_compatible(&self, simd_type: SimdType) -> bool
pub fn is_simd_compatible(&self, simd_type: SimdType) -> bool
Verify buffer is suitable for specific SIMD instruction set
Trait Implementations§
Source§impl Clone for AlignedBuffer
impl Clone for AlignedBuffer
Source§impl Debug for AlignedBuffer
impl Debug for AlignedBuffer
Source§impl Drop for AlignedBuffer
impl Drop for AlignedBuffer
impl Send for AlignedBuffer
impl Sync for AlignedBuffer
Auto Trait Implementations§
impl Freeze for AlignedBuffer
impl RefUnwindSafe for AlignedBuffer
impl Unpin for AlignedBuffer
impl UnwindSafe for AlignedBuffer
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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