Alignment

Trait Alignment 

Source
pub unsafe trait Alignment: Sealed { }
Expand description

Implemented for all Align<N> where N is a valid alignment (i.e., a power of two less-than-or-equal to 228).

use elain::{Align, Alignment};
use core::mem::align_of;

#[repr(C)]
struct Foo<const MIN_ALIGNMENT: usize>
where
    Align<MIN_ALIGNMENT>: Alignment
{
    _align: Align<MIN_ALIGNMENT>,
    bar: u8,
    baz: u16,
}

assert_eq!(align_of::<Foo<1>>(), 2);
assert_eq!(align_of::<Foo<2>>(), 2);
assert_eq!(align_of::<Foo<4>>(), 4);

Implementors§

Source§

impl Alignment for Align<1>

Source§

impl Alignment for Align<2>

Source§

impl Alignment for Align<4>

Source§

impl Alignment for Align<8>

Source§

impl Alignment for Align<16>

Source§

impl Alignment for Align<32>

Source§

impl Alignment for Align<64>

Source§

impl Alignment for Align<128>

Source§

impl Alignment for Align<256>

Source§

impl Alignment for Align<512>

Source§

impl Alignment for Align<1024>

Source§

impl Alignment for Align<2048>

Source§

impl Alignment for Align<4096>

Source§

impl Alignment for Align<8192>

Source§

impl Alignment for Align<16384>

Source§

impl Alignment for Align<32768>

Source§

impl Alignment for Align<65536>

Source§

impl Alignment for Align<131072>

Source§

impl Alignment for Align<262144>

Source§

impl Alignment for Align<524288>

Source§

impl Alignment for Align<1048576>

Source§

impl Alignment for Align<2097152>

Source§

impl Alignment for Align<4194304>

Source§

impl Alignment for Align<8388608>

Source§

impl Alignment for Align<16777216>

Source§

impl Alignment for Align<33554432>

Source§

impl Alignment for Align<67108864>

Source§

impl Alignment for Align<134217728>

Source§

impl Alignment for Align<268435456>

Source§

impl Alignment for Align<536870912>