pub struct AlignedVec<T> { /* private fields */ }
Expand description
A memory-aligned vector for optimal SIMD performance
Implementations§
Source§impl<T> AlignedVec<T>
impl<T> AlignedVec<T>
Sourcepub fn with_capacity(capacity: usize) -> Result<Self, Box<dyn Error>>
pub fn with_capacity(capacity: usize) -> Result<Self, Box<dyn Error>>
Create a new aligned vector with the specified capacity
Sourcepub fn from_vec(vec: Vec<T>) -> Result<Self, Box<dyn Error>>where
T: Copy,
pub fn from_vec(vec: Vec<T>) -> Result<Self, Box<dyn Error>>where
T: Copy,
Create a new aligned vector from an existing vector
Sourcepub fn as_mut_slice(&mut self) -> &mut [T]
pub fn as_mut_slice(&mut self) -> &mut [T]
Get a mutable slice of the vector
Sourcepub unsafe fn set_len(&mut self, new_len: usize)
pub unsafe fn set_len(&mut self, new_len: usize)
Unsafe method to set the length directly
§Safety
The caller must ensure that:
new_len
is <= capacity- Elements from index 0 to new_len-1 are properly initialized
Sourcepub fn as_mut_ptr(&mut self) -> *mut T
pub fn as_mut_ptr(&mut self) -> *mut T
Get a mutable pointer to the underlying data
Trait Implementations§
Source§impl<T> Drop for AlignedVec<T>
impl<T> Drop for AlignedVec<T>
impl<T: Send> Send for AlignedVec<T>
impl<T: Sync> Sync for AlignedVec<T>
Auto Trait Implementations§
impl<T> Freeze for AlignedVec<T>
impl<T> RefUnwindSafe for AlignedVec<T>where
T: RefUnwindSafe,
impl<T> Unpin for AlignedVec<T>
impl<T> UnwindSafe for AlignedVec<T>where
T: RefUnwindSafe,
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> 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