Skip to main content

generate_rust_fix_from_source

Function generate_rust_fix_from_source 

Source
pub fn generate_rust_fix_from_source(
    layout: &StructLayout,
    struct_source: &str,
) -> String
Expand description

Generate a source-preserving Rust fix: reorder field chunks extracted from struct_source (the original struct Name { ... } text) according to the optimal field order.

Preserves #[serde(...)], pub, pub(crate), doc comments (///), and any other leading attribute/comment lines verbatim.