#![doc(html_logo_url = "https://avatars2.githubusercontent.com/u/52050279?s=200&v=4")]
#[macro_use]
extern crate lazy_static;
pub type HandlerResult<T> = ::std::result::Result<T, Box<dyn std::error::Error + Sync + Send>>;
pub extern crate wapc_guest as wapc;
use wapc_guest::console_log;
#[macro_export]
macro_rules! actor_handlers(
{ $($key:path => $user_handler:ident),* } => {
use $crate::wapc::prelude::*;
wapc_handler!(handle_wapc);
fn handle_wapc(operation: &str, msg: &[u8]) -> CallResult {
$crate::logger::ensure_logger();
match operation {
$( $key => $user_handler(deserialize(msg)?)
.and_then(|r| serialize(r))
.map_err(|e| e.into()), )*
_ => Err("bad dispatch".into())
}
}
};
);
pub fn println(msg: &str) {
console_log(msg)
}
pub mod errors;
pub mod events;
pub mod extras;
pub mod http_client;
pub mod keyvalue;
pub mod logger;
pub mod messaging;
pub mod objectstore;
pub mod prelude;
pub mod untyped;