pub fn generate_auto_mod(filename: &str, api_defs: &[ApiDef]) -> io::Result<()> {
        let mut dest = BufWriter::new(File::create(filename).unwrap());

        writeln!(
            dest,
            "// This file is auto-generated by rute_gen. DO NOT EDIT.\n"
        )?;

        // Collect all then struct names (snake case) and get a sorted list in the end
        let mut names = api_defs
            .iter()
            .flat_map(|api_def| api_def.class_structs.iter())
            .map(|s| s.name.to_snake_case())
            .collect::<Vec<String>>();

        // rute auto has some extra stuff used by all the files
        //names.push("rute_auto".to_owned());
        names.sort();

        for entry in &names {
            writeln!(dest, "pub mod {}_ffi;", entry)?;
            writeln!(dest, "pub mod {};", entry)?;
        }

        writeln!(dest, "pub mod rute_ffi;")?;
        writeln!(dest, "pub mod rute_enums;")?;
        writeln!(dest, "pub mod rute;\n")?;

        for entry in &names {
            // TODO: Fixme
            writeln!(dest, "pub use {}::*;", entry)?;
            writeln!(dest, "pub use {}_ffi::*;", entry)?;
        }

        writeln!(dest, "pub use rute_ffi::*;")?;
        writeln!(dest, "pub use rute_enums::*;")?;
        writeln!(dest, "pub use rute::*;")
    }
///
/// Generates the Rust mod file to import all FFI and Rust generated code
///
Generates the Rust mod file to import all FFI and Rust generated code
Generates the Rust mod file to import all FFI and Rust generated code
pub fn generate_auto_mod(filename: &str, api_defs: &[ApiDef]) -> io::Result<()> {
        let mut dest = BufWriter::new(File::create(filename).unwrap());
        writeln!(
            dest,
            "// This file is auto-generated by rute_gen. DO NOT EDIT.\n"
        )?;
        // Collect all then struct names (snake case) and get a sorted list in the end
        let mut names = api_defs
            .iter()
            .flat_map(|api_def| api_def.class_structs.iter())
            .map(|s| s.name.to_snake_case())
            .collect::<Vec<String>>();
        // rute auto has some extra stuff used by all the files
        //names.push("rute_auto".to_owned());
        names.sort();
        for entry in &names {
            writeln!(dest, "pub mod {}_ffi;", entry)?;
            writeln!(dest, "pub mod {};", entry)?;
        }
        writeln!(dest, "pub mod rute_ffi;")?;
        writeln!(dest, "pub mod rute_enums;")?;
        writeln!(dest, "pub mod rute;\n")?;
        for entry in &names {
            // TODO: Fixme
            writeln!(dest, "pub use {}::*;", entry)?;
            writeln!(dest, "pub use {}_ffi::*;", entry)?;
        }
        writeln!(dest, "pub use rute_ffi::*;")?;
        writeln!(dest, "pub use rute_enums::*;")?;
        writeln!(dest, "pub use rute::*;")
    }
pub fn generate_auto_mod ( filename : & str , api_defs : & [ ApiDef ] ) -> io :: Result < ( ) > { let mut dest = BufWriter :: new ( File :: create ( filename ) . unwrap ( ) ) ; writeln ! ( dest " \n " ) ? ; // Collect all then struct names (snake case) and get a sorted list in the end let mut names = api_defs . iter ( ) . flat_map ( | api_def | api_def . class_structs . iter ( ) ) . map ( | s | s . name . to_snake_case ( ) ) . collect :: < Vec < String > > ( ) ; // rute auto has some extra stuff used by all the files //names.push("rute_auto".to_owned()); names . sort ( ) ; for entry in & names { writeln ! ( dest " " entry ) ? ; writeln ! ( dest " " entry ) ? ; } writeln ! ( dest " " ) ? ; writeln ! ( dest " " ) ? ; writeln ! ( dest " \n " ) ? ; for entry in & names { // TODO: Fixme writeln ! ( dest " " entry ) ? ; writeln ! ( dest " " entry ) ? ; } writeln ! ( dest " " ) ? ; writeln ! ( dest " " ) ? ; writeln ! ( dest " " ) }
Generates the Rust mod file to import all FFI and Rust generated code
Generates the Rust mod file to import all FFI and Rust generated code
filename
&str
api_defs
&[ApiDef]
filename
&str
api_defs
&[ApiDef]