58 lines
1.5 KiB
Rust
58 lines
1.5 KiB
Rust
use serde::Deserialize;
|
|
use serde::Serialize;
|
|
|
|
use super::ast_node::WasmAstNode;
|
|
use super::macros::to_wasm;
|
|
use super::to_wasm::ToWasm;
|
|
use super::AdditionalProperties;
|
|
use crate::types::GetAffiliatedKeywords;
|
|
use crate::types::PlainList;
|
|
use crate::types::PlainListType;
|
|
use crate::util::elisp_fact::ElispFact;
|
|
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
pub struct WasmPlainList {
|
|
#[serde(flatten)]
|
|
pub(crate) additional_properties: AdditionalProperties,
|
|
#[serde(rename = "type")]
|
|
pub(crate) list_type: String,
|
|
}
|
|
|
|
to_wasm!(
|
|
WasmPlainList,
|
|
PlainList<'s>,
|
|
original,
|
|
wasm_context,
|
|
{ WasmAstNode::PlainList(original) },
|
|
{ "plain-list".into() },
|
|
{
|
|
let additional_properties = original
|
|
.get_affiliated_keywords()
|
|
.to_wasm(wasm_context.clone())?;
|
|
|
|
let children = original
|
|
.children
|
|
.iter()
|
|
.map(|child| {
|
|
child
|
|
.to_wasm(wasm_context.clone())
|
|
.map(Into::<WasmAstNode>::into)
|
|
})
|
|
.collect::<Result<Vec<_>, _>>()?;
|
|
|
|
Ok((
|
|
children,
|
|
WasmPlainList {
|
|
additional_properties,
|
|
list_type: match original.list_type {
|
|
PlainListType::Unordered => "unordered",
|
|
PlainListType::Ordered => "ordered",
|
|
PlainListType::Descriptive => "descriptive",
|
|
}
|
|
.to_owned(),
|
|
},
|
|
))
|
|
}
|
|
);
|