Populate standard properties.

This commit is contained in:
Tom Alexander
2023-12-24 15:48:33 -05:00
parent 310ab2eab2
commit b9b3ef6e74
6 changed files with 127 additions and 19 deletions

View File

@@ -2,10 +2,15 @@
///
/// This exists to make changing the type signature easier.
macro_rules! to_wasm {
($ostruct:ty, $istruct:ty, $original:ident, $document:ident, $fnbody:tt) => {
impl<'s> From<(&'s str, $istruct)> for $ostruct {
fn from(value: (&'s str, $istruct)) -> $ostruct {
let ($original, $document) = value;
($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)?;
$fnbody
}
}