Files
organic/src/wasm/radio_target.rs
2023-12-30 12:17:04 -05:00

42 lines
958 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::compare::ElispFact;
use crate::types::RadioTarget;
use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize, Deserialize)]
pub struct WasmRadioTarget {
pub(crate) value: String,
}
to_wasm!(
WasmRadioTarget,
RadioTarget<'s>,
original,
wasm_context,
{ WasmAstNode::RadioTarget(original) },
{ "radio-target".into() },
{
let children = original
.children
.iter()
.map(|child| {
child
.to_wasm(wasm_context.clone())
.map(Into::<WasmAstNode>::into)
})
.collect::<Result<Vec<_>, _>>()?;
Ok((
children,
WasmRadioTarget {
value: original.value.to_owned(),
},
))
}
);