Add lifetime to wasm objects.
This commit is contained in:
parent
b9b3ef6e74
commit
2962f76c81
@ -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,
|
||||
})
|
||||
}
|
||||
);
|
||||
|
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user