///
/// Generates the implementations for the structs
///
Generates the implementations for the structs
Generates the implementations for the structs
fn generate_trait_impl<W: Write>(&self, dest: &mut W, sdef: &Struct) -> io::Result<()> {
        writeln!(dest, "pub trait {}Trait<'a> {{", sdef.name)?;
        let mut template_data = Object::new();
        template_data.insert("type_name".into(), Value::scalar(&sdef.name));
        template_data.insert(
            "type_name_snake".into(),
            Value::scalar(sdef.name.to_snake_case()),
        );
        let out = self.trait_impl_end_template.render(&template_data).unwrap();
        dest.write_all(out.as_bytes())?;
        for name in &sdef.full_inherit {
            let mut template_data = Object::new();
            template_data.insert("trait_name".into(), Value::scalar(name));
            template_data.insert("target_name".into(), Value::scalar(&sdef.name));
            template_data.insert("type_name".into(), Value::scalar(name));
            template_data.insert(
                "target_name_snake".into(),
                Value::scalar(name.to_snake_case()),
            );
            template_data.insert(
                "target_name_snake_org".into(),
                Value::scalar(name.to_snake_case()),
            );
            let out = self.trait_impl_template.render(&template_data).unwrap();
            dest.write_all(out.as_bytes())?;
        }
        Ok(())
    }
fn generate_trait_impl < W : Write > ( & self , dest : & mut W , sdef : & Struct ) -> io :: Result < ( ) > { writeln ! ( dest " " sdef name ) ? ; let mut template_data = Object :: new ( ) ; template_data . insert ( " " . into ( ) , Value :: scalar ( & sdef . name ) ) ; template_data . insert ( " " . into ( ) , Value :: scalar ( sdef . name . to_snake_case ( ) ) , ) ; let out = self . trait_impl_end_template . render ( & template_data ) . unwrap ( ) ; dest . write_all ( out . as_bytes ( ) ) ? ; for name in & sdef . full_inherit { let mut template_data = Object :: new ( ) ; template_data . insert ( " " . into ( ) , Value :: scalar ( name ) ) ; template_data . insert ( " " . into ( ) , Value :: scalar ( & sdef . name ) ) ; template_data . insert ( " " . into ( ) , Value :: scalar ( name ) ) ; template_data . insert ( " " . into ( ) , Value :: scalar ( name . to_snake_case ( ) ) , ) ; template_data . insert ( " " . into ( ) , Value :: scalar ( name . to_snake_case ( ) ) , ) ; let out = self . trait_impl_template . render ( & template_data ) . unwrap ( ) ; dest . write_all ( out . as_bytes ( ) ) ? ; } Ok ( ( ) ) }
Generates the implementations for the structs
Generates the implementations for the structs
&self
dest
&mut W
sdef
&Struct