pub struct AlignedVec<T> { /* private fields */ }Expand description
Cache-line-aligned vector wrapper.
On most modern x86-64 and ARM processors the cache line is 64 bytes. Aligning the start of a data buffer to a 64-byte boundary avoids false sharing between cores and helps the prefetcher.
Internally this uses a standard VecT` whose pointer is guaranteed to be
at least 64-byte aligned via a manual allocation strategy when the default
allocator does not already satisfy the requirement. On the vast majority of
platforms with jemalloc or mimalloc, 64-byte alignment for large arrays is
already the default, so this mainly serves as a documented guarantee.
Implementations§
Source§impl<T: Default + Clone> AlignedVec<T>
impl<T: Default + Clone> AlignedVec<T>
Source§impl<T: Clone> AlignedVec<T>
impl<T: Clone> AlignedVec<T>
Trait Implementations§
Source§impl<T: Clone> Clone for AlignedVec<T>
impl<T: Clone> Clone for AlignedVec<T>
Source§fn clone(&self) -> AlignedVec<T>
fn clone(&self) -> AlignedVec<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<T> Freeze for AlignedVec<T>
impl<T> RefUnwindSafe for AlignedVec<T>where
T: RefUnwindSafe,
impl<T> Send for AlignedVec<T>where
T: Send,
impl<T> Sync for AlignedVec<T>where
T: Sync,
impl<T> Unpin for AlignedVec<T>where
T: Unpin,
impl<T> UnsafeUnpin for AlignedVec<T>
impl<T> UnwindSafe for AlignedVec<T>where
T: UnwindSafe,
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.