fn order_file(file_path: &Path) -> io::Result<()> {
    println!("{:?}", file_path);
    let content = fs::read_to_string(file_path)?;
    let mut pad: format::PadMapping =
        toml::from_str(&content).expect("Error parsing file");
    sort_by_code(&mut pad);
    let toml = toml::to_string(&pad).expect("Error serializing file");
    fs::write(file_path, &toml)
}
/// This reads a file into a string
/// Tries to parse it from toml into a Controller struct
/// Sorts the inner structs (button, axis, etc.) by code
/// Tries to parse to toml again
/// Write to file
This reads a file into a string
Tries to parse it from toml into a Controller struct
Sorts the inner structs (button, axis, etc.) by code
Tries to parse to toml again
Write to file
This reads a file into a string Tries to parse it from toml into a Controller struct Sorts the inner structs ( button axis etc . ) by code Tries to parse to toml again Write to file
fn order_file(file_path: &Path) -> io::Result<()> {
    println!("{:?}", file_path);
    let content = fs::read_to_string(file_path)?;
    let mut pad: format::PadMapping =
        toml::from_str(&content).expect("Error parsing file");
    sort_by_code(&mut pad);
    let toml = toml::to_string(&pad).expect("Error serializing file");
    fs::write(file_path, &toml)
}
fn order_file ( file_path : & Path ) -> io :: Result < ( ) > { println ! ( " " file_path ) ; let content = fs :: read_to_string ( file_path ) ? ; let mut pad : format :: PadMapping = toml :: from_str ( & content ) . expect ( " " ) ; sort_by_code ( & mut pad ) ; let toml = toml :: to_string ( & pad ) . expect ( " " ) ; fs :: write ( file_path , & toml ) }
This reads a file into a string
Tries to parse it from toml into a Controller struct
Sorts the inner structs (button, axis, etc.)
This reads a file into a string Tries to parse it from toml into a Controller struct Sorts the inner structs ( button axis etc . )
file_path
&Path
file_path
&Path