pub fn execute_function(
    module: &Module,
    function: &str,
    args: Vec<ArcGearsObject>,
) -> ArcGearsResult {
    let mod_fn = module.get_function(function)?;
    let num_given_args = args.len();
    let num_fn_args = mod_fn.num_args();

    if num_given_args != num_fn_args {
        if num_given_args < num_fn_args {
            return Err(GearsError::InterOpError {
                error: InterOpErrorType::TooFewArgs,
                message: format!(
                    "Function missing args: {}, expected: {}, received: {}",
                    function, num_fn_args, num_given_args
                ),
            });
        } else {
            return Err(GearsError::InterOpError {
                error: InterOpErrorType::TooManyArgs,
                message: format!(
                    "Function pass extra args: {}, expected: {}, received: {}",
                    function, num_fn_args, num_given_args
                ),
            });
        }
    }

    execute(&mod_fn, &module, args)
}
/// Execute a function contained in a compiled module
Execute a function contained in a compiled module
Execute a function contained in a compiled module
pub fn execute_function(
    module: &Module,
    function: &str,
    args: Vec<ArcGearsObject>,
) -> ArcGearsResult {
    let mod_fn = module.get_function(function)?;
    let num_given_args = args.len();
    let num_fn_args = mod_fn.num_args();
    if num_given_args != num_fn_args {
        if num_given_args < num_fn_args {
            return Err(GearsError::InterOpError {
                error: InterOpErrorType::TooFewArgs,
                message: format!(
                    "Function missing args: {}, expected: {}, received: {}",
                    function, num_fn_args, num_given_args
                ),
            });
        } else {
            return Err(GearsError::InterOpError {
                error: InterOpErrorType::TooManyArgs,
                message: format!(
                    "Function pass extra args: {}, expected: {}, received: {}",
                    function, num_fn_args, num_given_args
                ),
            });
        }
    }
    execute(&mod_fn, &module, args)
}
pub fn execute_function ( module : & Module , function : & str , args : Vec < ArcGearsObject > , ) -> ArcGearsResult { let mod_fn = module . get_function ( function ) ? ; let num_given_args = args . len ( ) ; let num_fn_args = mod_fn . num_args ( ) ; if num_given_args != num_fn_args { if num_given_args < num_fn_args { return Err ( GearsError :: InterOpError { error : InterOpErrorType :: TooFewArgs , message : format ! ( " " function num_fn_args num_given_args ) , } ) ; } else { return Err ( GearsError :: InterOpError { error : InterOpErrorType :: TooManyArgs , message : format ! ( " " function num_fn_args num_given_args ) , } ) ; } } execute ( & mod_fn , & module , args ) }
Execute a function contained in a compiled module
Execute a function contained in a compiled module
module
&Module
function
&str
args
Vec<ArcGearsObject>