Add a lifetime for data in the parsed result but not from the source.

This commit is contained in:
Tom Alexander
2023-12-27 11:36:47 -05:00
parent abf066701e
commit 1a70b3d2c0
63 changed files with 276 additions and 309 deletions

View File

@@ -12,22 +12,22 @@ use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub struct WasmDocument<'s> {
pub struct WasmDocument<'s, 'p> {
standard_properties: WasmStandardProperties,
additional_properties: Vec<(String, &'s str)>,
children: Vec<WasmAstNode<'s>>,
category: Option<String>,
children: Vec<WasmAstNode<'s, 'p>>,
category: Option<&'p str>,
path: Option<PathBuf>,
}
to_wasm!(
WasmDocument<'s>,
WasmDocument<'s, 'p>,
Document<'s>,
original,
wasm_context,
standard_properties,
{
let category = original.category.clone();
let category = original.category.as_ref().map(String::as_str);
let path = original.path.clone();
let additional_properties: Vec<(String, &str)> = original
@@ -65,8 +65,8 @@ to_wasm!(
}
);
impl<'s> Into<WasmAstNode<'s>> for WasmDocument<'s> {
fn into(self) -> WasmAstNode<'s> {
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmDocument<'s, 'p> {
fn into(self) -> WasmAstNode<'s, 'p> {
WasmAstNode::Document(self)
}
}