pub fn from_crate(
        c : &model::ComCrate
    ) -> Result<ManifestModel, GeneratorError>
    {
        let lib = c.lib().as_ref().ok_or( GeneratorError::MissingLibrary )?;

        // Gather all the com classes. These need to be declared in the manifest.
        let classes = lib.coclasses().iter().map(|class_path| {

            let class_name = class_path
                    .get_ident()
                    .expect( "coclass had no name" )
                    .to_string();
            let coclass = &c.structs()[ &class_name.to_string() ];
            let clsid = coclass.clsid().as_ref()
                    .ok_or_else( || GeneratorError::MissingClsid(
                                        coclass.name().to_string() ) )?;
            Ok( ManifestCoClass {
                name : coclass.name().to_string(),
                clsid : format!( "{}", clsid ),
            } )
        } ).collect::<Result<Vec<_>, GeneratorError>>()?;

        Ok( ManifestModel {
            lib_name : utils::pascal_case( lib.name() ),
            file_name : lib.name().to_owned(),
            lib_id : format!( "{}", lib.libid() ),
            coclasses : classes,
        } )
    }
/// Generates the model from an existing Intercom crate model.
Generates the model from an existing Intercom crate model.
Generates the model from an existing Intercom crate model .
pub fn from_crate(
        c : &model::ComCrate
    ) -> Result<ManifestModel, GeneratorError>
    {
        let lib = c.lib().as_ref().ok_or( GeneratorError::MissingLibrary )?;
        // Gather all the com classes. These need to be declared in the manifest.
        let classes = lib.coclasses().iter().map(|class_path| {
            let class_name = class_path
                    .get_ident()
                    .expect( "coclass had no name" )
                    .to_string();
            let coclass = &c.structs()[ &class_name.to_string() ];
            let clsid = coclass.clsid().as_ref()
                    .ok_or_else( || GeneratorError::MissingClsid(
                                        coclass.name().to_string() ) )?;
            Ok( ManifestCoClass {
                name : coclass.name().to_string(),
                clsid : format!( "{}", clsid ),
            } )
        } ).collect::<Result<Vec<_>, GeneratorError>>()?;
        Ok( ManifestModel {
            lib_name : utils::pascal_case( lib.name() ),
            file_name : lib.name().to_owned(),
            lib_id : format!( "{}", lib.libid() ),
            coclasses : classes,
        } )
    }
pub fn from_crate ( c : & model :: ComCrate ) -> Result < ManifestModel , GeneratorError > { let lib = c . lib ( ) . as_ref ( ) . ok_or ( GeneratorError :: MissingLibrary ) ? ; // Gather all the com classes. These need to be declared in the manifest. let classes = lib . coclasses ( ) . iter ( ) . map ( | class_path | { let class_name = class_path . get_ident ( ) . expect ( " " ) . to_string ( ) ; let coclass = & c . structs ( ) [ & class_name . to_string ( ) ] ; let clsid = coclass . clsid ( ) . as_ref ( ) . ok_or_else ( | | GeneratorError :: MissingClsid ( coclass . name ( ) . to_string ( ) ) ) ? ; Ok ( ManifestCoClass { name : coclass . name ( ) . to_string ( ) , clsid : format ! ( " " clsid ) , } ) } ) . collect :: < Result < Vec < _ > , GeneratorError > > ( ) ? ; Ok ( ManifestModel { lib_name : utils :: pascal_case ( lib . name ( ) ) , file_name : lib . name ( ) . to_owned ( ) , lib_id : format ! ( " " lib libid ( ) ) , coclasses : classes , } ) }
Generates the model from an existing Intercom crate model.
Generates the model from an existing Intercom crate model .
c
&model::ComCrate