#[repr(align(64))]pub struct CachePadded<T>(pub T);Expand description
A wrapper that aligns T to a cache-line boundary.
On the ET-SoC-1 (a software-coherent architecture), two values sharing a
cache line that are written by distinct harts without explicit cache
operations cause false-sharing corruption. Wrapping per-hart output data
in CachePadded ensures each instance occupies a distinct 64-byte line,
making cross-hart false sharing structurally impossible regardless of the
surrounding allocation layout.
The inner value is accessed directly via the public tuple field 0.
§Example
use et_abi::CachePadded;
let cell: CachePadded<u64> = CachePadded(0);
assert_eq!(core::mem::align_of::<CachePadded<u64>>(), 64);Tuple Fields§
§0: TTrait Implementations§
Source§impl<T: Clone> Clone for CachePadded<T>
impl<T: Clone> Clone for CachePadded<T>
Source§fn clone(&self) -> CachePadded<T>
fn clone(&self) -> CachePadded<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 moreimpl<T: Copy> Copy for CachePadded<T>
Source§impl<T: Debug> Debug for CachePadded<T>
impl<T: Debug> Debug for CachePadded<T>
Source§impl<T: Default> Default for CachePadded<T>
impl<T: Default> Default for CachePadded<T>
Source§fn default() -> CachePadded<T>
fn default() -> CachePadded<T>
Returns the “default value” for a type. Read more
impl<T: Eq> Eq for CachePadded<T>
Source§impl<T: PartialEq> PartialEq for CachePadded<T>
impl<T: PartialEq> PartialEq for CachePadded<T>
impl<T: PartialEq> StructuralPartialEq for CachePadded<T>
Auto Trait Implementations§
impl<T> Freeze for CachePadded<T>where
T: Freeze,
impl<T> RefUnwindSafe for CachePadded<T>where
T: RefUnwindSafe,
impl<T> Send for CachePadded<T>where
T: Send,
impl<T> Sync for CachePadded<T>where
T: Sync,
impl<T> Unpin for CachePadded<T>where
T: Unpin,
impl<T> UnsafeUnpin for CachePadded<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for CachePadded<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