Type Alias repr_offset::get_field_offset::FieldPrivacy
source · pub type FieldPrivacy<This, FN> = <This as GetFieldOffset<FN>>::Privacy;
Expand description
Gets the privacy of a field in the GetFieldOffset<FN>
impl for This
.
§Warning
Because the field may be private this can break when asking for the privacy of fields in types from external crates.
§Example
use repr_offset::{
get_field_offset::FieldPrivacy,
privacy::{IsPrivate, IsPublic},
tstr::TS,
Aligned,
};
let _: FieldPrivacy<Foo, TS!(x)> = IsPrivate;
let _: FieldPrivacy<Foo, TS!(y)> = IsPrivate;
let _: FieldPrivacy<Foo, TS!(z)> = IsPrivate;
let _: FieldPrivacy<Foo, TS!(w)> = IsPublic;
mod foo {
use super::*;
#[repr(C)]
pub struct Foo {
x: u8,
pub(super) y: u16,
pub(crate) z: u32,
pub w: u64,
}
repr_offset::unsafe_struct_field_offsets!{
alignment = repr_offset::Aligned,
impl[] Foo {
const OFFSET_X, x: u8;
pub(super) const OFFSET_Y, y: u16;
pub(crate) const OFFSET_Z, z: u32;
pub const OFFSET_W, w: u64;
}
}
}
use foo::Foo;