fn generate_wrapper_classes_defs<W: Write>(
        &self,
        f: &mut W,
        api_def: &ApiDef,
    ) -> io::Result<()> {
        for sdef in api_def
            .class_structs
            .iter()
            .filter(|s| s.should_gen_wrap_class())
        {
            let mut template_data = Object::new();
            let inherits_widget = sdef.inherits_widget();

            template_data.insert("struct_name".into(), Value::scalar(&sdef.name));
            template_data.insert("qt_name".into(), Value::scalar(&sdef.qt_name));
            template_data.insert("widget".into(), Value::scalar(inherits_widget));

            let mut events = String::with_capacity(64 * 1024);

            sdef.functions
                .iter()
                .filter(|func| func.func_type == FunctionType::Event)
                .for_each(|f| {
                    let setup = self.generate_event_setup_def(&sdef, &f);
                    events.push_str(&setup);
                });

            template_data.insert("events".into(), Value::scalar(events));
            template_data.insert(
                "supports_clone".into(),
                Value::scalar(sdef.supports_cpp_clone()),
            );

            let res = self.wrapper_template.render(&template_data).unwrap();
            f.write_all(res.as_bytes())?;
        }

        Ok(())
    }
///
/// Generate wrapper classes for all the Widges. This allows us to override
/// virtual functions from the outside (in C and other langs)
/// defs and add custom data that we need. This also supports a callback that is called
/// upon destruction of the object from the C++ side. This allows the callback to tag
/// the object (on the Rust side) as invalid. This allows for proper error handling if user
/// tries to access a "deleted" object
///
Generate wrapper classes for all the Widges. This allows us to override
virtual functions from the outside (in C and other langs)
defs and add custom data that we need. This also supports a callback that is called
upon destruction of the object from the C++ side. This allows the callback to tag
the object (on the Rust side) as invalid. This allows for proper error handling if user
tries to access a "deleted" object
Generate wrapper classes for all the Widges . This allows us to override virtual functions from the outside ( in C and other langs ) defs and add custom data that we need . This also supports a callback that is called upon destruction of the object from the C ++ side . This allows the callback to tag the object ( on the Rust side ) as invalid . This allows for proper error handling if user tries to access a " deleted " object
fn generate_wrapper_classes_defs<W: Write>(
        &self,
        f: &mut W,
        api_def: &ApiDef,
    ) -> io::Result<()> {
        for sdef in api_def
            .class_structs
            .iter()
            .filter(|s| s.should_gen_wrap_class())
        {
            let mut template_data = Object::new();
            let inherits_widget = sdef.inherits_widget();
            template_data.insert("struct_name".into(), Value::scalar(&sdef.name));
            template_data.insert("qt_name".into(), Value::scalar(&sdef.qt_name));
            template_data.insert("widget".into(), Value::scalar(inherits_widget));
            let mut events = String::with_capacity(64 * 1024);
            sdef.functions
                .iter()
                .filter(|func| func.func_type == FunctionType::Event)
                .for_each(|f| {
                    let setup = self.generate_event_setup_def(&sdef, &f);
                    events.push_str(&setup);
                });
            template_data.insert("events".into(), Value::scalar(events));
            template_data.insert(
                "supports_clone".into(),
                Value::scalar(sdef.supports_cpp_clone()),
            );
            let res = self.wrapper_template.render(&template_data).unwrap();
            f.write_all(res.as_bytes())?;
        }
        Ok(())
    }
fn generate_wrapper_classes_defs < W : Write > ( & self , f : & mut W , api_def : & ApiDef , ) -> io :: Result < ( ) > { for sdef in api_def . class_structs . iter ( ) . filter ( | s | s . should_gen_wrap_class ( ) ) { let mut template_data = Object :: new ( ) ; let inherits_widget = sdef . inherits_widget ( ) ; template_data . insert ( " " . into ( ) , Value :: scalar ( & sdef . name ) ) ; template_data . insert ( " " . into ( ) , Value :: scalar ( & sdef . qt_name ) ) ; template_data . insert ( " " . into ( ) , Value :: scalar ( inherits_widget ) ) ; let mut events = String :: with_capacity ( 64 * 1024 ) ; sdef . functions . iter ( ) . filter ( | func | func . func_type == FunctionType :: Event ) . for_each ( | f | { let setup = self . generate_event_setup_def ( & sdef , & f ) ; events . push_str ( & setup ) ; } ) ; template_data . insert ( " " . into ( ) , Value :: scalar ( events ) ) ; template_data . insert ( " " . into ( ) , Value :: scalar ( sdef . supports_cpp_clone ( ) ) , ) ; let res = self . wrapper_template . render ( & template_data ) . unwrap ( ) ; f . write_all ( res . as_bytes ( ) ) ? ; } Ok ( ( ) ) }
Generate wrapper classes for all the Widges.
Generate wrapper classes for all the Widges .
&self
f
&mut W
api_def
&ApiDef
&self
f
&mut W
api_def
&ApiDef