Skip to main content

StructLayout

Struct StructLayout 

Source
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: bool

True 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: bool

True 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

Source§

fn clone(&self) -> StructLayout

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StructLayout

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for StructLayout

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for StructLayout

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,