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 moreSource§impl Debug for StructLayout
impl Debug for StructLayout
Source§impl<'de> Deserialize<'de> for StructLayout
impl<'de> Deserialize<'de> for StructLayout
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more