smpl_utils/
macros.rs

1#[allow(unused_macros)]
2#[macro_export]
3macro_rules! log {
4    ($($t:tt)*) => {
5        #[cfg(target_arch = "wasm32")] web_sys::console::log_1(& format!($($t)*)
6        .into());
7    };
8}
9#[allow(unused_macros)]
10#[macro_export]
11macro_rules! convert_enum_from {
12    ($src:ident, $dst:ident, $($variant:ident,)*) => {
13        impl From <$src > for $dst { fn from(src : $src) -> Self { match src { $($src
14        ::$variant => Self::$variant,)* } } }
15    };
16}
17#[allow(unused_macros)]
18#[macro_export]
19macro_rules! convert_enum_into {
20    ($src:ident, $dst:ident, $($variant:ident,)*) => {
21        impl Into <$dst > for $src { fn into(self) -> $dst { match self {
22        $(Self::$variant => $dst ::$variant,)* } } }
23    };
24}