[−][src]Function glsp::bind_rfn
pub fn bind_rfn<S, ArgsWithTag, Ret, F>(name: S, f: F) -> Result<(), GError> where
S: ToSym,
Wrapper<ArgsWithTag, Ret, F>: WrappedCall,
Wrapper<ArgsWithTag, Ret, F>: 'static,
Binds a Rust function to a global variable.
GameLisp will perform automatic conversions for the function's parameters and return
value. See glsp::rfn
and glsp::named_rfn
for the details.
glsp::bind_rfn(name, &f)
is equivalent to:
let sym = name.to_sym()? let rfn = glsp::named_rfn(sym, &f); glsp::bind_global(sym, rfn)