Macro rustyscript::sync_callback
source · macro_rules! sync_callback { (|$($arg:ident: $arg_ty:ty),*| $body:expr) => { ... }; }
Expand description
A simple helper macro to create a callback for use with Runtime::register_function
Takes care of deserializing arguments and serializing the result
§Example
use rustyscript::{ Error, sync_callback };
let add = sync_callback!(
|a: i64, b: i64| {
Ok::<i64, Error>(a + b)
}
);