///
/// Generates the implementations for the structs
///
Generates the implementations for the structs
Generates the implementations for the structs
fn generate_traits_impl<W: Write>(&self, f: &mut W, api_def: &ApiDef) -> io::Result<()> {
        api_def.class_structs.iter().try_for_each(|s| {
            self.generate_trait_impl(f, s)?;
            // Implement drop for structs that needs it
            if s.should_generate_drop() {
                let mut template_data = Object::new();
                template_data.insert("type_name".into(), Value::scalar(s.name.clone()));
                template_data.insert(
                    "type_snake_name".into(),
                    Value::scalar(s.name.to_snake_case()),
                );
                let output = self.drop_template.render(&template_data).unwrap();
                f.write_all(output.as_bytes())?;
            }
            Ok(())
        })
    }
fn generate_traits_impl < W : Write > ( & self , f : & mut W , api_def : & ApiDef ) -> io :: Result < ( ) > { api_def . class_structs . iter ( ) . try_for_each ( | s | { self . generate_trait_impl ( f , s ) ? ; // Implement drop for structs that needs it if s . should_generate_drop ( ) { let mut template_data = Object :: new ( ) ; template_data . insert ( " " . into ( ) , Value :: scalar ( s . name . clone ( ) ) ) ; template_data . insert ( " " . into ( ) , Value :: scalar ( s . name . to_snake_case ( ) ) , ) ; let output = self . drop_template . render ( & template_data ) . unwrap ( ) ; f . write_all ( output . as_bytes ( ) ) ? ; } Ok ( ( ) ) } ) }
Generates the implementations for the structs
Generates the implementations for the structs
&self
f
&mut W
api_def
&ApiDef