Implement clock.
This commit is contained in:
parent
f50415cb32
commit
c46a935cfc
@ -4,15 +4,17 @@ use serde::Serialize;
|
|||||||
use super::ast_node::WasmAstNode;
|
use super::ast_node::WasmAstNode;
|
||||||
use super::macros::to_wasm;
|
use super::macros::to_wasm;
|
||||||
use super::to_wasm::ToWasm;
|
use super::to_wasm::ToWasm;
|
||||||
use super::AdditionalProperties;
|
|
||||||
use crate::compare::ElispFact;
|
use crate::compare::ElispFact;
|
||||||
use crate::types::Clock;
|
use crate::types::Clock;
|
||||||
|
use crate::types::ClockStatus;
|
||||||
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
use crate::wasm::to_wasm::ToWasmStandardProperties;
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
pub struct WasmClock {
|
pub struct WasmClock {
|
||||||
#[serde(flatten)]
|
#[serde(rename = "value")]
|
||||||
pub(crate) additional_properties: AdditionalProperties,
|
pub(crate) timestamp: Box<WasmAstNode>,
|
||||||
|
pub(crate) duration: Option<String>,
|
||||||
|
pub(crate) status: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
to_wasm!(
|
to_wasm!(
|
||||||
@ -21,12 +23,20 @@ to_wasm!(
|
|||||||
original,
|
original,
|
||||||
wasm_context,
|
wasm_context,
|
||||||
{ WasmAstNode::Clock(original) },
|
{ WasmAstNode::Clock(original) },
|
||||||
{ "TODO".into() },
|
{ "clock".into() },
|
||||||
{
|
{
|
||||||
Ok((
|
Ok((
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
WasmClock {
|
WasmClock {
|
||||||
additional_properties: AdditionalProperties::default(),
|
timestamp: Box::new(Into::<WasmAstNode>::into(
|
||||||
|
original.timestamp.to_wasm(wasm_context.clone())?,
|
||||||
|
)),
|
||||||
|
duration: original.duration.map(|s| s.to_owned()),
|
||||||
|
status: match original.status {
|
||||||
|
ClockStatus::Running => "running",
|
||||||
|
ClockStatus::Closed => "closed",
|
||||||
|
}
|
||||||
|
.to_owned(),
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user