fn expand_input_param(
    fun: &Function,
    param: &str,
    kind: &ParamType,
    custom_struct_name: &Option<&Property>,
) -> Result<TokenStream, Error> {
    match kind {
        ParamType::Array(ty, _) => {
            let ty = expand_input_param(fun, param, ty, custom_struct_name)?;
            Ok(quote! {
                ::std::vec::Vec<#ty>
            })
        }
        ParamType::Enum(_) => {
            let ident = ident(
                &extract_custom_type_name_from_abi_property(
                    custom_struct_name.unwrap(),
                    &CustomType::Enum,
                )?
                .to_class_case(),
            );
            Ok(quote! { #ident })
        }
        ParamType::Struct(_) => {
            let ident = ident(
                &extract_custom_type_name_from_abi_property(
                    custom_struct_name.unwrap(),
                    &CustomType::Struct,
                )?
                .to_class_case(),
            );
            Ok(quote! { #ident })
        }
        // Primitive type
        _ => expand_type(kind),
    }
}
// Expands the type of an argument being passed in a function declaration.
// I.e.: `pub fn my_func(my_arg: u32) -> ()`, in this case, `u32` is the
// type, coming in as a `ParamType::U32`.
Expands the type of an argument being passed in a function declaration.
Expands the type of an argument being passed in a function declaration .
fn expand_input_param(
    fun: &Function,
    param: &str,
    kind: &ParamType,
    custom_struct_name: &Option<&Property>,
) -> Result<TokenStream, Error> {
    match kind {
        ParamType::Array(ty, _) => {
            let ty = expand_input_param(fun, param, ty, custom_struct_name)?;
            Ok(quote! {
                ::std::vec::Vec<#ty>
            })
        }
        ParamType::Enum(_) => {
            let ident = ident(
                &extract_custom_type_name_from_abi_property(
                    custom_struct_name.unwrap(),
                    &CustomType::Enum,
                )?
                .to_class_case(),
            );
            Ok(quote! { #ident })
        }
        ParamType::Struct(_) => {
            let ident = ident(
                &extract_custom_type_name_from_abi_property(
                    custom_struct_name.unwrap(),
                    &CustomType::Struct,
                )?
                .to_class_case(),
            );
            Ok(quote! { #ident })
        }
        // Primitive type
        _ => expand_type(kind),
    }
}
fn expand_input_param ( fun : & Function , param : & str , kind : & ParamType , custom_struct_name : & Option < & Property > , ) -> Result < TokenStream , Error > { match kind { ParamType :: Array ( ty , _ ) => { let ty = expand_input_param ( fun , param , ty , custom_struct_name ) ? ; Ok ( quote ! { std vec Vec ty } ) } ParamType :: Enum ( _ ) => { let ident = ident ( & extract_custom_type_name_from_abi_property ( custom_struct_name . unwrap ( ) , & CustomType :: Enum , ) ? . to_class_case ( ) , ) ; Ok ( quote ! { ident } ) } ParamType :: Struct ( _ ) => { let ident = ident ( & extract_custom_type_name_from_abi_property ( custom_struct_name . unwrap ( ) , & CustomType :: Struct , ) ? . to_class_case ( ) , ) ; Ok ( quote ! { ident } ) } // Primitive type _ => expand_type ( kind ) , } }
Expands the type of an argument being passed in a function declaration.
Expands the type of an argument being passed in a function declaration .
fun
&Function
param
&str
kind
&ParamType
custom_struct_name
&Option<&Property>