Add lifetime to wasm objects.

This commit is contained in:
Tom Alexander 2023-12-25 11:19:09 -05:00
parent b9b3ef6e74
commit 2962f76c81
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 8 additions and 4 deletions

View File

@ -1,3 +1,5 @@
use std::marker::PhantomData;
use organic::types::Document;
use serde::Deserialize;
use serde::Serialize;
@ -10,13 +12,14 @@ use crate::wasm::to_wasm::ToWasmStandardProperties;
#[derive(Serialize, Deserialize)]
#[serde(tag = "ast_node")]
#[serde(rename = "org-data")]
pub(crate) struct WasmDocument {
pub(crate) struct WasmDocument<'s> {
standard_properties: WasmStandardProperties,
children: Vec<()>,
phantom: PhantomData<&'s ()>,
}
to_wasm!(
WasmDocument,
WasmDocument<'s>,
Document<'s>,
wasm_context,
standard_properties,
@ -24,6 +27,7 @@ to_wasm!(
Ok(WasmDocument {
standard_properties,
children: Vec::new(),
phantom: PhantomData,
})
}
);

View File

@ -5,9 +5,9 @@ use super::document::WasmDocument;
#[derive(Serialize, Deserialize)]
#[serde(tag = "status", content = "content")]
pub(crate) enum ParseResult {
pub(crate) enum ParseResult<'s> {
#[serde(rename = "success")]
Success(WasmDocument),
Success(WasmDocument<'s>),
#[serde(rename = "error")]
Error(String),