nodarium_utils/
lib.rs

1mod encoding;
2mod nodes;
3mod tree;
4pub use encoding::*;
5pub use nodes::reset_call_count;
6pub use tree::*;
7pub mod geometry;
8
9#[cfg(debug_assertions)]
10#[macro_export]
11macro_rules! log {
12    ($($arg:tt)*) => {{
13        use web_sys::console;
14        console::log_1(&format!($($arg)*).into());
15    }}
16}
17
18#[cfg(not(debug_assertions))]
19#[macro_export]
20macro_rules! log {
21    ($($arg:tt)*) => {{
22        // This will expand to nothing in release builds
23    }};
24}
25
26pub fn set_panic_hook() {
27    // When the `console_error_panic_hook` feature is enabled, we can call the
28    // `set_panic_hook` function at least once during initialization, and then
29    // we will get better error messages if our code ever panics.
30    //
31    // For more details see
32    // https://github.com/rustwasm/console_error_panic_hook#readme
33    #[cfg(feature = "console_error_panic_hook")]
34    console_error_panic_hook::set_once();
35}