fn generate_arg_type(
        &self,
        dest: &mut String,
        var: &Variable,
        return_arg: IsReturnArg,
        need_lifetime: bool,
        real_type: bool,
    ) {
        dest.clear();

        // Run code to replace type if neeed
        let type_name = {
            match self.type_handler.get(var) {
                Some(handler) => handler.replace_type(var, return_arg),
                None => var.type_name.clone().into(),
            }
        };

        if var.optional {
            dest.push_str("Option<");
        }

        match var.vtype {
            VariableType::None => dest.push_str("<None>"),
            VariableType::SelfType => dest.push_str("&self"),
            VariableType::Primitive => dest.push_str(&type_name),
            VariableType::Enum => dest.push_str(&var.enum_sub_type),
            VariableType::Regular => {
                if real_type {
                    dest.push_str(get_real_type(&type_name));
                } else {
                    dest.push_str(&get_trait_name(&type_name));
                }

                if need_lifetime {
                    dest.push_str("<'a>");
                }
            }
            VariableType::Str => {
                if return_arg == IsReturnArg::Yes {
                    dest.push_str("String");
                } else {
                    dest.push_str("&str");
                }
            }

            VariableType::Reference => {
                if return_arg == IsReturnArg::No {
                    dest.push('&');
                }

                if real_type {
                    dest.push_str(get_real_type(&type_name));
                } else {
                    dest.push_str(&get_trait_name(&type_name));
                }

                if need_lifetime {
                    dest.push_str("<'a>");
                }
            }
        }

        if var.optional {
            dest.push('>');
        }
    }
///
/// Takes in a varibale and generates a Rust function variable argument
///
Takes in a varibale and generates a Rust function variable argument
Takes in a varibale and generates a Rust function variable argument
fn generate_arg_type(
        &self,
        dest: &mut String,
        var: &Variable,
        return_arg: IsReturnArg,
        need_lifetime: bool,
        real_type: bool,
    ) {
        dest.clear();
        // Run code to replace type if neeed
        let type_name = {
            match self.type_handler.get(var) {
                Some(handler) => handler.replace_type(var, return_arg),
                None => var.type_name.clone().into(),
            }
        };
        if var.optional {
            dest.push_str("Option<");
        }
        match var.vtype {
            VariableType::None => dest.push_str("<None>"),
            VariableType::SelfType => dest.push_str("&self"),
            VariableType::Primitive => dest.push_str(&type_name),
            VariableType::Enum => dest.push_str(&var.enum_sub_type),
            VariableType::Regular => {
                if real_type {
                    dest.push_str(get_real_type(&type_name));
                } else {
                    dest.push_str(&get_trait_name(&type_name));
                }
                if need_lifetime {
                    dest.push_str("<'a>");
                }
            }
            VariableType::Str => {
                if return_arg == IsReturnArg::Yes {
                    dest.push_str("String");
                } else {
                    dest.push_str("&str");
                }
            }
            VariableType::Reference => {
                if return_arg == IsReturnArg::No {
                    dest.push('&');
                }
                if real_type {
                    dest.push_str(get_real_type(&type_name));
                } else {
                    dest.push_str(&get_trait_name(&type_name));
                }
                if need_lifetime {
                    dest.push_str("<'a>");
                }
            }
        }
        if var.optional {
            dest.push('>');
        }
    }
fn generate_arg_type ( & self , dest : & mut String , var : & Variable , return_arg : IsReturnArg , need_lifetime : bool , real_type : bool , ) { dest . clear ( ) ; // Run code to replace type if neeed let type_name = { match self . type_handler . get ( var ) { Some ( handler ) => handler . replace_type ( var , return_arg ) , None => var . type_name . clone ( ) . into ( ) , } } ; if var . optional { dest . push_str ( " " ) ; } match var . vtype { VariableType :: None => dest . push_str ( " " ) , VariableType :: SelfType => dest . push_str ( " " ) , VariableType :: Primitive => dest . push_str ( & type_name ) , VariableType :: Enum => dest . push_str ( & var . enum_sub_type ) , VariableType :: Regular => { if real_type { dest . push_str ( get_real_type ( & type_name ) ) ; } else { dest . push_str ( & get_trait_name ( & type_name ) ) ; } if need_lifetime { dest . push_str ( " " ) ; } } VariableType :: Str => { if return_arg == IsReturnArg :: Yes { dest . push_str ( " " ) ; } else { dest . push_str ( " " ) ; } } VariableType :: Reference => { if return_arg == IsReturnArg :: No { dest . push ( '&' ) ; } if real_type { dest . push_str ( get_real_type ( & type_name ) ) ; } else { dest . push_str ( & get_trait_name ( & type_name ) ) ; } if need_lifetime { dest . push_str ( " " ) ; } } } if var . optional { dest . push ( '>' ) ; } }
Takes in a varibale and generates a Rust function variable argument
Takes in a varibale and generates a Rust function variable argument
&self
dest
&mut String
var
&Variable
return_arg
IsReturnArg
need_lifetime
bool
real_type
bool
&self
dest
&mut String
var
&Variable
return_arg
IsReturnArg
need_lifetime
bool
real_type
bool