pub fn from_ast(
        item : &::syn::Item,
    ) -> ParseResult< ComImpl >
    {
        // Resolve the idents and functions.
        let ( itf_ident_opt, struct_ident, fns ) =
                ::utils::get_impl_data( item )
                    .ok_or_else( || ParseError::ComImpl(
                            item.get_ident().unwrap().to_string(),
                            "<Unknown>".into(),
                            "Unsupported associated item".into() ) )?;
        let is_trait_impl = itf_ident_opt.is_some();
        let itf_ident = itf_ident_opt.unwrap_or_else( || struct_ident.clone() );

        let variants = OrderMap::from_iter(
            [ ModelTypeSystem::Automation, ModelTypeSystem::Raw ].iter().map( |&ts| {

            let itf_unique_ident = Ident::new(
                    &format!( "{}_{:?}", itf_ident.to_string(), ts ), Span::call_site() );

            // Turn the impl methods into MethodInfo.
            //
            // TODO: Currently we ignore invalid methods. We should probably do
            //       something smarter.
            let methods = fns.iter()
                .map( | sig |
                    ComMethodInfo::new( sig, ts ).map_err( |_| sig.ident.clone() ) )
                .filter_map( Result::ok )
                .collect::<Vec<_>>();

            ( ts, ComImplVariant {
                type_system: ts,
                interface_unique_name: itf_unique_ident,
                methods,
            } )
        } ) );

        Ok( ComImpl {
            struct_name: struct_ident,
            interface_display_name: itf_ident,
            variants,
            is_trait_impl,
        } )
    }
/// Creates ComImpl from AST elements.
Creates ComImpl from AST elements.
Creates ComImpl from AST elements .
pub fn from_ast(
        item : &::syn::Item,
    ) -> ParseResult< ComImpl >
    {
        // Resolve the idents and functions.
        let ( itf_ident_opt, struct_ident, fns ) =
                ::utils::get_impl_data( item )
                    .ok_or_else( || ParseError::ComImpl(
                            item.get_ident().unwrap().to_string(),
                            "<Unknown>".into(),
                            "Unsupported associated item".into() ) )?;
        let is_trait_impl = itf_ident_opt.is_some();
        let itf_ident = itf_ident_opt.unwrap_or_else( || struct_ident.clone() );
        let variants = OrderMap::from_iter(
            [ ModelTypeSystem::Automation, ModelTypeSystem::Raw ].iter().map( |&ts| {
            let itf_unique_ident = Ident::new(
                    &format!( "{}_{:?}", itf_ident.to_string(), ts ), Span::call_site() );
            // Turn the impl methods into MethodInfo.
            //
            // TODO: Currently we ignore invalid methods. We should probably do
            //       something smarter.
            let methods = fns.iter()
                .map( | sig |
                    ComMethodInfo::new( sig, ts ).map_err( |_| sig.ident.clone() ) )
                .filter_map( Result::ok )
                .collect::<Vec<_>>();
            ( ts, ComImplVariant {
                type_system: ts,
                interface_unique_name: itf_unique_ident,
                methods,
            } )
        } ) );
        Ok( ComImpl {
            struct_name: struct_ident,
            interface_display_name: itf_ident,
            variants,
            is_trait_impl,
        } )
    }
pub fn from_ast ( item : & :: syn :: Item , ) -> ParseResult < ComImpl > { // Resolve the idents and functions. let ( itf_ident_opt , struct_ident , fns ) = :: utils :: get_impl_data ( item ) . ok_or_else ( | | ParseError :: ComImpl ( item . get_ident ( ) . unwrap ( ) . to_string ( ) , " " . into ( ) , " " . into ( ) ) ) ? ; let is_trait_impl = itf_ident_opt . is_some ( ) ; let itf_ident = itf_ident_opt . unwrap_or_else ( | | struct_ident . clone ( ) ) ; let variants = OrderMap :: from_iter ( [ ModelTypeSystem :: Automation , ModelTypeSystem :: Raw ] . iter ( ) . map ( | & ts | { let itf_unique_ident = Ident :: new ( & format ! ( " " itf_ident to_string ( ) ts ) , Span :: call_site ( ) ) ; // Turn the impl methods into MethodInfo. // // TODO: Currently we ignore invalid methods. We should probably do //       something smarter. let methods = fns . iter ( ) . map ( | sig | ComMethodInfo :: new ( sig , ts ) . map_err ( | _ | sig . ident . clone ( ) ) ) . filter_map ( Result :: ok ) . collect :: < Vec < _ > > ( ) ; ( ts , ComImplVariant { type_system : ts , interface_unique_name : itf_unique_ident , methods , } ) } ) ) ; Ok ( ComImpl { struct_name : struct_ident , interface_display_name : itf_ident , variants , is_trait_impl , } ) }
Creates ComImpl from AST elements.
Creates ComImpl from AST elements .
item
&::syn::Item