63 lines
1.9 KiB
Rust
63 lines
1.9 KiB
Rust
use serde::Deserialize;
|
|
use serde::Serialize;
|
|
|
|
use super::ast_node::WasmAstNode;
|
|
use super::macros::to_wasm;
|
|
use super::to_wasm::ToWasm;
|
|
use crate::types::Planning;
|
|
use crate::util::elisp_fact::ElispFact;
|
|
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
pub struct WasmPlanning {
|
|
pub(crate) scheduled: Option<Box<WasmAstNode>>,
|
|
pub(crate) deadline: Option<Box<WasmAstNode>>,
|
|
pub(crate) closed: Option<Box<WasmAstNode>>,
|
|
}
|
|
|
|
to_wasm!(
|
|
WasmPlanning,
|
|
Planning<'s>,
|
|
original,
|
|
wasm_context,
|
|
{ WasmAstNode::Planning(original) },
|
|
{ "planning".into() },
|
|
{
|
|
Ok((
|
|
Vec::new(),
|
|
WasmPlanning {
|
|
scheduled: original
|
|
.scheduled
|
|
.as_ref()
|
|
.map(|child| {
|
|
child
|
|
.to_wasm(wasm_context.clone())
|
|
.map(Into::<WasmAstNode>::into)
|
|
})
|
|
.map_or(Ok(None), |r| r.map(Some))?
|
|
.map(Box::new),
|
|
deadline: original
|
|
.deadline
|
|
.as_ref()
|
|
.map(|child| {
|
|
child
|
|
.to_wasm(wasm_context.clone())
|
|
.map(Into::<WasmAstNode>::into)
|
|
})
|
|
.map_or(Ok(None), |r| r.map(Some))?
|
|
.map(Box::new),
|
|
closed: original
|
|
.closed
|
|
.as_ref()
|
|
.map(|child| {
|
|
child
|
|
.to_wasm(wasm_context.clone())
|
|
.map(Into::<WasmAstNode>::into)
|
|
})
|
|
.map_or(Ok(None), |r| r.map(Some))?
|
|
.map(Box::new),
|
|
},
|
|
))
|
|
}
|
|
);
|