organic/src/wasm/export_snippet.rs

35 lines
837 B
Rust
Raw Normal View History

use serde::Deserialize;
use serde::Serialize;
use super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::to_wasm::ToWasm;
2023-12-30 22:02:43 -05:00
use crate::util::elisp_fact::ElispFact;
use crate::types::ExportSnippet;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize, Deserialize)]
2023-12-29 12:49:43 -05:00
pub struct WasmExportSnippet {
2023-12-30 16:18:08 -05:00
#[serde(rename = "back-end")]
pub(crate) backend: String,
pub(crate) value: Option<String>,
}
to_wasm!(
2023-12-29 12:49:43 -05:00
WasmExportSnippet,
2023-12-25 11:51:39 -05:00
ExportSnippet<'s>,
2023-12-25 12:32:35 -05:00
original,
wasm_context,
{ WasmAstNode::ExportSnippet(original) },
2023-12-30 16:18:08 -05:00
{ "export-snippet".into() },
{
Ok((
Vec::new(),
WasmExportSnippet {
2023-12-30 16:18:08 -05:00
backend: original.backend.to_owned(),
value: original.contents.map(|s| s.to_owned()),
},
))
}
);