fn gen_forward_declaration<W: Write>(&mut self, dest: &mut W, sdef: &Struct) -> io::Result<()> {
        let mut imports = BTreeMap::new();

        for func in &sdef.functions {
            if let Some(ref ret_val) = func.return_val {
                match ret_val.vtype {
                    VariableType::Regular => {
                        if ret_val.type_name != sdef.name {
                            imports.insert(&ret_val.type_name, format!("RU{}", ret_val.type_name));
                        }
                    }
                    VariableType::Reference => {
                        if ret_val.type_name != sdef.name {
                            imports.insert(&ret_val.type_name, format!("RU{}", ret_val.type_name));
                        }
                    }

                    _ => (),
                }
            }
        }

        for (module, name) in imports {
            writeln!(dest, "#[allow(unused_imports)]")?;
            writeln!(dest, "use auto::{}_ffi::{};", module.to_snake_case(), name)?;
        }

        for name in &sdef.full_inherit {
            if name != &sdef.name {
                writeln!(dest, "#[allow(unused_imports)]")?;
                writeln!(dest, "use auto::{}_ffi::*;", name.to_snake_case())?;
            }
        }

        writeln!(dest, "#[allow(unused_imports)]")?;
        writeln!(dest, "use std::os::raw::c_void;")
    }
///
/// This will find all the variables and figure out what use
///
This will find all the variables and figure out what use
This will find all the variables and figure out what use
fn gen_forward_declaration<W: Write>(&mut self, dest: &mut W, sdef: &Struct) -> io::Result<()> {
        let mut imports = BTreeMap::new();
        for func in &sdef.functions {
            if let Some(ref ret_val) = func.return_val {
                match ret_val.vtype {
                    VariableType::Regular => {
                        if ret_val.type_name != sdef.name {
                            imports.insert(&ret_val.type_name, format!("RU{}", ret_val.type_name));
                        }
                    }
                    VariableType::Reference => {
                        if ret_val.type_name != sdef.name {
                            imports.insert(&ret_val.type_name, format!("RU{}", ret_val.type_name));
                        }
                    }
                    _ => (),
                }
            }
        }
        for (module, name) in imports {
            writeln!(dest, "#[allow(unused_imports)]")?;
            writeln!(dest, "use auto::{}_ffi::{};", module.to_snake_case(), name)?;
        }
        for name in &sdef.full_inherit {
            if name != &sdef.name {
                writeln!(dest, "#[allow(unused_imports)]")?;
                writeln!(dest, "use auto::{}_ffi::*;", name.to_snake_case())?;
            }
        }
        writeln!(dest, "#[allow(unused_imports)]")?;
        writeln!(dest, "use std::os::raw::c_void;")
    }
fn gen_forward_declaration < W : Write > ( & mut self , dest : & mut W , sdef : & Struct ) -> io :: Result < ( ) > { let mut imports = BTreeMap :: new ( ) ; for func in & sdef . functions { if let Some ( ref ret_val ) = func . return_val { match ret_val . vtype { VariableType :: Regular => { if ret_val . type_name != sdef . name { imports . insert ( & ret_val . type_name , format ! ( " " ret_val type_name ) ) ; } } VariableType :: Reference => { if ret_val . type_name != sdef . name { imports . insert ( & ret_val . type_name , format ! ( " " ret_val type_name ) ) ; } } _ => ( ) , } } } for ( module , name ) in imports { writeln ! ( dest " " ) ? ; writeln ! ( dest " " module to_snake_case ( ) name ) ? ; } for name in & sdef . full_inherit { if name != & sdef . name { writeln ! ( dest " " ) ? ; writeln ! ( dest " " name to_snake_case ( ) ) ? ; } } writeln ! ( dest " " ) ? ; writeln ! ( dest " " ) }
This will find all the variables and figure out what use
This will find all the variables and figure out what use
&mut self
dest
&mut W
sdef
&Struct
&mut self
dest
&mut W
sdef
&Struct