pub struct StructLayout {
pub fields: Vec<FieldInfo>,
pub total_size: usize,
pub heap_field_mask: u64,
}Expand description
Computed C-compatible layout for a typed struct.
The layout starts with an 8-byte HeapHeader at offset 0. Fields follow at offset 8+ with natural alignment padding between them. The total size is rounded up to 8-byte alignment.
Fields§
§fields: Vec<FieldInfo>§total_size: usize§heap_field_mask: u64Implementations§
Source§impl StructLayout
impl StructLayout
Sourcepub fn new(fields: &[(impl AsRef<str>, FieldKind)]) -> Self
pub fn new(fields: &[(impl AsRef<str>, FieldKind)]) -> Self
Compute layout from field definitions. HeapHeader is at offset 0 (8 bytes). Fields start at offset 8, with natural alignment padding.
pub fn field_offset(&self, idx: usize) -> usize
pub fn field_kind(&self, idx: usize) -> FieldKind
pub fn total_size(&self) -> usize
pub fn field_count(&self) -> usize
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StructLayout
impl RefUnwindSafe for StructLayout
impl Send for StructLayout
impl Sync for StructLayout
impl Unpin for StructLayout
impl UnsafeUnpin for StructLayout
impl UnwindSafe for StructLayout
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