pub mod types; pub mod errors; pub mod broker_connection; pub mod broker; pub mod connection; pub mod actor; pub mod actors; pub mod utils; pub static WS_PORT: u16 = 1025; #[cfg(target_arch = "wasm32")] use wasm_bindgen::prelude::*; #[cfg(target_arch = "wasm32")] #[wasm_bindgen] extern "C" { // Use `js_namespace` here to bind `console.log(..)` instead of just // `log(..)` #[wasm_bindgen(js_namespace = console)] pub fn log(s: &str); // The `console.log` is quite polymorphic, so we can bind it with multiple // signatures. Note that we need to use `js_name` to ensure we always call // `log` in JS. #[wasm_bindgen(js_namespace = console, js_name = log)] fn log_u32(a: u32); // Multiple arguments too! #[wasm_bindgen(js_namespace = console, js_name = log)] fn log_many(a: &str, b: &str); } #[cfg(target_arch = "wasm32")] #[macro_export] macro_rules! log { // Note that this is using the `log` function imported above during // `bare_bones` ($($t:tt)*) => (log(&format_args!($($t)*).to_string())) } #[cfg(not(target_arch = "wasm32"))] #[macro_export] macro_rules! log { ($($t:tt)*) => (debug_print::debug_println!($($t)*)) }