pub type FieldAlignment<This, FN> = <<This as AssertPublicField<FN>>::This as GetFieldOffset<FN>>::Alignment;
Expand description

Gets the alignment of a public field in the GetPubFieldOffset<FN> impl for This.

Example

use repr_offset::{
    get_field_offset::FieldAlignment,
    for_examples::{ReprC, ReprPacked},
    tstr::TS,
    Aligned, Unaligned,
};

type Inner = ReprPacked<i16, i32, i64, i128>;

type This = ReprC<Inner, &'static str, Option<usize>, bool>;

// Fields directly inside a ReprC are all aligned.
let _: FieldAlignment<This, TS!(a)> = Aligned;
let _: FieldAlignment<This, TS!(b)> = Aligned;
let _: FieldAlignment<This, TS!(c)> = Aligned;
let _: FieldAlignment<This, TS!(d)> = Aligned;

// Fields inside a ReprPacked are all unaligned.
let _: FieldAlignment<This, TS!(a, a)> = Unaligned;
let _: FieldAlignment<This, TS!(a, b)> = Unaligned;
let _: FieldAlignment<This, TS!(a, c)> = Unaligned;
let _: FieldAlignment<This, TS!(a, d)> = Unaligned;