#[macro_use]
macro_rules! gen_rt_ty {
{
$(#[$meta:meta])*
$vis:vis
$id:ident$(<
$($lt:lifetime),*
$(,)?
$($param:ident),*
>)?(
$path:path
) $(;)?
} => {
paste::paste! {
$(#[$meta])*
#[derive(derive_more::Unwrap)]
#[unwrap(owned, ref, ref_mut)]
#[allow(clippy::large_enum_variant)]
$vis enum $id $(<$($lt,)* $($param,)*>)? {
#[cfg(feature = "sys")]
Sys(crate::backend::sys::$path),
#[cfg(feature = "v8")]
V8(crate::backend::v8::$path),
#[cfg(feature = "wamr")]
Wamr(crate::backend::wamr::$path),
#[cfg(feature = "wasmi")]
Wasmi(crate::backend::wasmi::$path),
#[cfg(feature = "js")]
Js(crate::backend::js::$path),
#[cfg(feature = "jsc")]
Jsc(crate::backend::jsc::$path),
}
}
};
}
#[macro_use]
macro_rules! match_rt {
(on $self:expr => $var:ident { $stmt:expr }) => {
match $self {
#[cfg(feature = "sys")]
Self::Sys($var) => $stmt,
#[cfg(feature = "wamr")]
Self::Wamr($var) => $stmt,
#[cfg(feature = "wasmi")]
Self::Wasmi($var) => $stmt,
#[cfg(feature = "v8")]
Self::V8($var) => $stmt,
#[cfg(feature = "js")]
Self::Js($var) => $stmt,
#[cfg(feature = "jsc")]
Self::Jsc($var) => $stmt,
}
};
(on $value:expr ; $match:expr => $var:ident { $stmt:expr }) => {
match $self {
#[cfg(feature = "sys")]
Self::Sys($var) => $stmt,
#[cfg(feature = "wamr")]
Self::Wamr($var) => $stmt,
#[cfg(feature = "wasmi")]
Self::Wasmi($var) => $stmt,
#[cfg(feature = "v8")]
Self::V8($var) => $stmt,
#[cfg(feature = "js")]
Self::Js($var) => $stmt,
#[cfg(feature = "jsc")]
Self::Jsc($var) => $stmt,
}
};
}
pub(crate) use {gen_rt_ty, match_rt};