Switch everything over to the new to_wasm macro.
This commit is contained in:
@@ -1,24 +1,19 @@
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use super::ast_node::WasmAstNode;
|
||||
use super::macros::to_wasm;
|
||||
use super::standard_properties::WasmStandardProperties;
|
||||
use super::to_wasm::ToWasm;
|
||||
use super::AdditionalProperties;
|
||||
#[cfg(feature = "wasm_test")]
|
||||
use crate::compare::ElispFact;
|
||||
use crate::types::GetAffiliatedKeywords;
|
||||
use crate::types::Paragraph;
|
||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||
use crate::wasm::WasmAstNode;
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
#[serde(tag = "ast_node")]
|
||||
#[serde(rename = "paragraph")]
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct WasmParagraph {
|
||||
pub(crate) standard_properties: WasmStandardProperties,
|
||||
#[serde(flatten)]
|
||||
pub(crate) additional_properties: AdditionalProperties,
|
||||
pub(crate) children: Vec<WasmAstNode>,
|
||||
}
|
||||
|
||||
to_wasm!(
|
||||
@@ -26,7 +21,8 @@ to_wasm!(
|
||||
Paragraph<'s>,
|
||||
original,
|
||||
wasm_context,
|
||||
standard_properties,
|
||||
{ WasmAstNode::Paragraph(original) },
|
||||
{ "paragraph".into() },
|
||||
{
|
||||
let additional_properties = original
|
||||
.get_affiliated_keywords()
|
||||
@@ -42,23 +38,11 @@ to_wasm!(
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
|
||||
Ok(WasmParagraph {
|
||||
standard_properties,
|
||||
additional_properties,
|
||||
Ok((
|
||||
children,
|
||||
})
|
||||
WasmParagraph {
|
||||
additional_properties,
|
||||
},
|
||||
))
|
||||
}
|
||||
);
|
||||
|
||||
impl Into<WasmAstNode> for WasmParagraph {
|
||||
fn into(self) -> WasmAstNode {
|
||||
WasmAstNode::Paragraph(self)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "wasm_test")]
|
||||
impl<'s> ElispFact<'s> for WasmParagraph {
|
||||
fn get_elisp_name<'b>(&'b self) -> std::borrow::Cow<'s, str> {
|
||||
"paragraph".into()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user