organic/src/wasm/planning.rs
Tom Alexander f4e0dddd9d
All checks were successful
clippy Build clippy has succeeded
rust-foreign-document-test Build rust-foreign-document-test has succeeded
rust-build Build rust-build has succeeded
rust-test Build rust-test has succeeded
Fix clippy.
2023-12-30 23:14:40 -05:00

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),
},
))
}
);