pub struct StructLayout {
pub name: String,
pub total_size: usize,
pub align: usize,
pub fields: Vec<Field>,
pub source_file: Option<String>,
pub source_line: Option<u32>,
pub arch: &'static ArchConfig,
pub is_packed: bool,
pub is_union: bool,
pub is_repr_rust: bool,
pub suppressed_findings: Vec<String>,
pub uncertain_fields: Vec<String>,
}Expand description
One complete struct as read from DWARF or source and enriched by analysis.
Fields§
§name: String§total_size: usize§align: usize§fields: Vec<Field>§source_file: Option<String>§source_line: Option<u32>§arch: &'static ArchConfig§is_packed: bool§is_union: boolTrue when this layout was parsed from a C/C++ union declaration.
All fields share the same base offset (0); analysis suppresses reorder
and padding findings that do not apply to unions.
is_repr_rust: boolTrue when this is a Rust struct with repr(Rust) (i.e. no #[repr(C)],
#[repr(packed)], or #[repr(transparent)]). The compiler is free to
reorder fields and eliminate padding — padlock’s findings describe
declared-order waste, which may not match the actual runtime layout.
Always false for DWARF/binary layouts (which are always accurate).
suppressed_findings: Vec<String>Finding kinds that are suppressed for this struct via a source annotation.
Populated by source frontends when they encounter a suppression directive:
- Rust:
#[padlock_suppress = "ReorderSuggestion,FalseSharing"] - C/C++/Go/Zig:
// padlock: ignore[ReorderSuggestion,FalseSharing]
Values match the variant names of [padlock_core::findings::Finding]:
"PaddingWaste", "ReorderSuggestion", "FalseSharing", "LocalityIssue".
uncertain_fields: Vec<String>Field names whose type size could not be accurately determined from source
alone (e.g. a qualified name like driver.Connector whose package is not
in the analyzed source set and may be an interface rather than a struct).
When non-empty, padding and reorder findings on this struct may be
inaccurate. For precise sizing use binary analysis or --go-types.
Trait Implementations§
Source§impl Clone for StructLayout
impl Clone for StructLayout
Source§fn clone(&self) -> StructLayout
fn clone(&self) -> StructLayout
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more