pub struct StructLayout {
pub struct_name: String,
pub fields: Vec<(String, u64)>,
pub total_size: u64,
pub alignment: u64,
}Expand description
Describes the memory layout of a struct, used for field reordering analysis.
Fields§
§struct_name: StringThe name of the struct.
fields: Vec<(String, u64)>Ordered list of (field_name, field_size_bytes) pairs.
total_size: u64Total size of the struct in bytes (including padding).
alignment: u64Required alignment of the struct in bytes.
Implementations§
Source§impl StructLayout
impl StructLayout
Sourcepub fn is_cache_aligned(&self) -> bool
pub fn is_cache_aligned(&self) -> bool
Returns true if the struct’s total size is a multiple of the cache line size (64 bytes).
Sourcepub fn padding_bytes(&self) -> u64
pub fn padding_bytes(&self) -> u64
Returns the number of padding bytes in the struct.
Sourcepub fn cache_lines_used(&self) -> u64
pub fn cache_lines_used(&self) -> u64
Returns the number of cache lines the struct spans.
Trait Implementations§
Source§impl Clone for StructLayout
impl Clone for StructLayout
Source§fn clone(&self) -> StructLayout
fn clone(&self) -> StructLayout
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StructLayout
impl Debug for StructLayout
Source§impl PartialEq for StructLayout
impl PartialEq for StructLayout
impl StructuralPartialEq for StructLayout
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