organic/src/wasm/export_snippet.rs
2023-12-30 22:19:16 -05:00

35 lines
837 B
Rust

use serde::Deserialize;
use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::to_wasm::ToWasm;
use crate::util::elisp_fact::ElispFact;
use crate::types::ExportSnippet;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmExportSnippet {
#[serde(rename = "back-end")]
pub(crate) backend: String,
pub(crate) value: Option<String>,
}
to_wasm!(
WasmExportSnippet,
ExportSnippet<'s>,
original,
wasm_context,
{ WasmAstNode::ExportSnippet(original) },
{ "export-snippet".into() },
{
Ok((
Vec::new(),
WasmExportSnippet {
backend: original.backend.to_owned(),
value: original.contents.map(|s| s.to_owned()),
},
))
}
);