pub struct Aligned<A: Alignment, T> { /* private fields */ }
Expand description
Wrapper type that aligns T
to at least Alignment
It adds no size to the layout of the struct if the size is a multiple of the alignment,
otherwise the size is rounded up to the next multiple of the alignment
assert_eq!(size_of::<Aligned<A16, u8>>(), size_of::<A16>());
assert_eq!(size_of::<Aligned<A256, [u8; 256]>>(), size_of::<[u8; 256]>());
assert_eq!(size_of::<Aligned<A512, [u8; 81920]>>(), size_of::<[u8; 81920]>());
Implementations§
Trait Implementations§
Source§impl<A: Ord + Alignment, T: Ord> Ord for Aligned<A, T>
impl<A: Ord + Alignment, T: Ord> Ord for Aligned<A, T>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<A: PartialOrd + Alignment, T: PartialOrd> PartialOrd for Aligned<A, T>
impl<A: PartialOrd + Alignment, T: PartialOrd> PartialOrd for Aligned<A, T>
impl<A: Copy + Alignment, T: Copy> Copy for Aligned<A, T>
impl<A: Eq + Alignment, T: Eq> Eq for Aligned<A, T>
impl<A: Alignment, T> StructuralPartialEq for Aligned<A, T>
Auto Trait Implementations§
impl<A, T> Freeze for Aligned<A, T>
impl<A, T> RefUnwindSafe for Aligned<A, T>where
T: RefUnwindSafe,
A: RefUnwindSafe,
impl<A, T> Send for Aligned<A, T>where
T: Send,
impl<A, T> Sync for Aligned<A, T>where
T: Sync,
impl<A, T> Unpin for Aligned<A, T>
impl<A, T> UnwindSafe for Aligned<A, T>where
T: UnwindSafe,
A: 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