organic/src/wasm/macros.rs

16 lines
483 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 {
($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;
$fnbody
}
}
};
}
pub(crate) use to_wasm;