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