[−][src]Struct maligned::Aligned
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
impl<A: Alignment, T> Aligned<A, T>
[src]
pub fn new(t: T) -> Self
[src]
Creates a new instance of Aligned
pub fn into_inner(self) -> T
[src]
Consumes Aligned and returns the wrapped value
Trait Implementations
impl<A: Alignment, T> AsMut<T> for Aligned<A, T>
[src]
impl<A: Alignment, T> AsRef<T> for Aligned<A, T>
[src]
impl<A: Clone + Alignment, T: Clone> Clone for Aligned<A, T>
[src]
fn clone(&self) -> Aligned<A, T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<A: Copy + Alignment, T: Copy> Copy for Aligned<A, T>
[src]
impl<A: Debug + Alignment, T: Debug> Debug for Aligned<A, T>
[src]
impl<A: Default + Alignment, T: Default> Default for Aligned<A, T>
[src]
impl<A: Alignment, T> Deref for Aligned<A, T>
[src]
impl<A: Alignment, T> DerefMut for Aligned<A, T>
[src]
impl<A: Eq + Alignment, T: Eq> Eq for Aligned<A, T>
[src]
impl<A: Alignment, T> From<T> for Aligned<A, T>
[src]
impl<A: Hash + Alignment, T: Hash> Hash for Aligned<A, T>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<A: Ord + Alignment, T: Ord> Ord for Aligned<A, T>
[src]
fn cmp(&self, other: &Aligned<A, T>) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<A: PartialEq + Alignment, T: PartialEq> PartialEq<Aligned<A, T>> for Aligned<A, T>
[src]
impl<A: PartialOrd + Alignment, T: PartialOrd> PartialOrd<Aligned<A, T>> for Aligned<A, T>
[src]
fn partial_cmp(&self, other: &Aligned<A, T>) -> Option<Ordering>
[src]
fn lt(&self, other: &Aligned<A, T>) -> bool
[src]
fn le(&self, other: &Aligned<A, T>) -> bool
[src]
fn gt(&self, other: &Aligned<A, T>) -> bool
[src]
fn ge(&self, other: &Aligned<A, T>) -> bool
[src]
impl<A: Alignment, T> StructuralEq for Aligned<A, T>
[src]
impl<A: Alignment, T> StructuralPartialEq for Aligned<A, T>
[src]
Auto Trait Implementations
impl<A, T> Send for Aligned<A, T> where
T: Send,
T: Send,
impl<A, T> Sync for Aligned<A, T> where
T: Sync,
T: Sync,
impl<A, T> Unpin for Aligned<A, T> where
A: Unpin,
T: Unpin,
A: Unpin,
T: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<!> for T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,