pub struct SimdAllocator { /* private fields */ }Expand description
SIMD-optimized allocator with alignment guarantees
Implementations§
Source§impl SimdAllocator
impl SimdAllocator
Sourcepub const fn with_alignment(alignment: usize) -> Self
pub const fn with_alignment(alignment: usize) -> Self
Create a new SIMD allocator with custom alignment
Sourcepub fn stats(&self) -> &AllocatorStats
pub fn stats(&self) -> &AllocatorStats
Get allocator statistics
Sourcepub fn allocate_simd<T>(&self, count: usize) -> Option<NonNull<T>>
pub fn allocate_simd<T>(&self, count: usize) -> Option<NonNull<T>>
Allocate aligned memory for SIMD operations
Sourcepub unsafe fn deallocate_simd<T>(&self, ptr: NonNull<T>, count: usize)
pub unsafe fn deallocate_simd<T>(&self, ptr: NonNull<T>, count: usize)
Deallocate SIMD-aligned memory previously allocated by allocate_simd.
§Safety
ptr must have been allocated by this allocator with count elements of type T, and
must not be used after this call.
Sourcepub fn allocate_zeroed_simd<T>(&self, count: usize) -> Option<NonNull<T>>where
T: Copy,
pub fn allocate_zeroed_simd<T>(&self, count: usize) -> Option<NonNull<T>>where
T: Copy,
Allocate zero-initialized SIMD memory
Sourcepub unsafe fn reallocate_simd<T>(
&self,
ptr: NonNull<T>,
old_count: usize,
new_count: usize,
) -> Option<NonNull<T>>
pub unsafe fn reallocate_simd<T>( &self, ptr: NonNull<T>, old_count: usize, new_count: usize, ) -> Option<NonNull<T>>
Reallocate SIMD memory with preserved alignment.
§Safety
ptr must have been allocated by this allocator with old_count elements of type T.
The returned pointer (if Some) replaces ptr, which must not be used after this call.
Trait Implementations§
Source§impl Default for SimdAllocator
impl Default for SimdAllocator
Source§impl GlobalAlloc for SimdAllocator
impl GlobalAlloc for SimdAllocator
Source§unsafe fn alloc(&self, layout: Layout) -> *mut u8
unsafe fn alloc(&self, layout: Layout) -> *mut u8
Allocates memory as described by the given
layout. Read moreAuto Trait Implementations§
impl !Freeze for SimdAllocator
impl RefUnwindSafe for SimdAllocator
impl Send for SimdAllocator
impl Sync for SimdAllocator
impl Unpin for SimdAllocator
impl UnsafeUnpin for SimdAllocator
impl UnwindSafe for SimdAllocator
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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