---
source: crates/aviutl2-macros/src/module_functions.rs
expression: format_tokens(output)
---
impl MyModule {
    fn my_function(hoge: i32) -> i32 {
        hoge + 1
    }
}
::aviutl2::__internal_module! {
    impl ::aviutl2::module::ScriptModuleFunctions for MyModule {
        fn functions() -> Vec<::aviutl2::module::ModuleFunction> {
            let mut functions = Vec::new();
            functions.push(::aviutl2::module::ModuleFunction {
                name: "my_function".to_string(),
                func: bridge_my_function,
            });
            return functions;
            extern "C" fn bridge_my_function(
                smp: *mut ::aviutl2::sys::module2::SCRIPT_MODULE_PARAM,
            ) {
                let mut params =
                    unsafe { ::aviutl2::module::ScriptModuleCallHandle::from_raw(smp) };
                let hoge: i32 = match <i32 as ::aviutl2::module::FromScriptModuleParam>::from_param(
                    &params, 0usize,
                ) {
                    ::std::option::Option::Some(value) => value,
                    ::std::option::Option::None => {
                        let _ = params.set_error(&format!(
                            "Failed to convert parameter #{} to {}",
                            0usize,
                            stringify!(i32)
                        ));
                        return;
                    }
                };
                let fn_result = <MyModule>::my_function(hoge);
                ::aviutl2::module::__push_return_value(&mut params, fn_result);
            }
        }
    }
}
