Apply C/C++ struct reorderings in-place, returning the modified source.
Each layout in layouts is looked up by name; matched structs are replaced
with the optimally-ordered definition. Field declarations (including comments
and annotations such as GUARDED_BY) are preserved verbatim from the original
source when possible; IR-based generation is used as a fallback.
Replacements are applied back-to-front so byte offsets remain valid.
Apply Rust struct reorderings in-place, returning the modified source.
Preserves pub, pub(crate), #[serde(...)], /// doc-comments, and other
attributes verbatim; falls back to IR-based generation when source cannot be parsed.
Apply Zig struct reorderings in-place, returning the modified source.
Preserves field comments and annotations verbatim; falls back to IR-based generation.
Generate a source-preserving Rust fix: reorder field chunks extracted from
struct_source (the original struct Name { ... } text) according to the
optimal field order.
Render a reordered Zig struct definition as source text.
Zig structs are declared as const Name = struct { ... };.
If the layout is packed, the output uses packed struct.