organic/src/wasm/macros.rs

21 lines
681 B
Rust
Raw Normal View History

2023-12-24 13:18:06 -05:00
/// Write the implementation for the intermediate ast node.
///
/// This exists to make changing the type signature easier.
macro_rules! to_wasm {
2023-12-24 15:48:33 -05:00
($ostruct:ty, $istruct:ty, $wasm_context:ident, $standard_properties:ident, $fnbody:tt) => {
impl<'s> ToWasm for $istruct {
type Output = $ostruct;
fn to_wasm(
&self,
$wasm_context: crate::wasm::to_wasm::ToWasmContext<'_>,
) -> Result<Self::Output, crate::error::CustomError> {
let $standard_properties = self.to_wasm_standard_properties($wasm_context)?;
2023-12-24 13:18:06 -05:00
$fnbody
}
}
};
}
pub(crate) use to_wasm;