padlock-core
Core library for padlock — a struct memory layout analyzer for C, C++, Rust, and Go.
This crate provides:
- Intermediate representation (
StructLayout,Field,AccessPattern) — the shared data model all frontends and backends produce and consume - Architecture constants (
ArchConfig) for x86-64, AArch64, Apple Silicon, WASM32, RISC-V 64 - Analysis passes: padding detection, reorder suggestions, false-sharing detection, locality analysis, and impact scoring
- Report types (
Report,StructReport,Finding) — the output of running all analysis passes over a set of layouts
Usage
padlock-core is an internal library crate. If you want to analyze struct layouts, install the CLI:
To use padlock-core in your own tool, add it as a dependency and call Report::from_layouts(&layouts).
The test-helpers feature exposes fixture layouts (connection_layout(), packed_layout()) for use in tests of crates that depend on padlock-core.
Part of padlock
padlock-cli— CLI (padlock+cargo-padlockbinaries)padlock-core— IR, analysis passes, findings (this crate)padlock-source— Source analysis (C/C++/Rust/Go)padlock-dwarf— Binary analysis (DWARF/PDB)padlock-output— Output formatters (terminal/JSON/SARIF/diff)padlock-macros— Compile-time layout assertions