organic/src/wasm/section.rs

37 lines
837 B
Rust
Raw Normal View History

use serde::Serialize;
2023-12-25 17:55:48 +00:00
use super::ast_node::WasmAstNode;
use super::macros::to_wasm;
use super::standard_properties::WasmStandardProperties;
use super::to_wasm::ToWasm;
use crate::types::Section;
use crate::wasm::to_wasm::ToWasmStandardProperties;
2023-12-25 17:42:38 +00:00
#[derive(Debug, Serialize)]
#[serde(tag = "ast_node")]
2023-12-25 17:55:48 +00:00
#[serde(rename = "section")]
pub struct WasmSection<'s, 'p> {
standard_properties: WasmStandardProperties,
2023-12-27 17:04:54 +00:00
children: Vec<WasmAstNode<'s, 'p>>,
}
to_wasm!(
WasmSection<'s, 'p>,
2023-12-25 16:51:39 +00:00
Section<'s>,
2023-12-25 17:32:35 +00:00
original,
wasm_context,
standard_properties,
{
2023-12-25 16:51:39 +00:00
Ok(WasmSection {
standard_properties,
children: Vec::new(),
})
}
);
2023-12-25 17:55:48 +00:00
impl<'s, 'p> Into<WasmAstNode<'s, 'p>> for WasmSection<'s, 'p> {
fn into(self) -> WasmAstNode<'s, 'p> {
2023-12-25 17:55:48 +00:00
WasmAstNode::Section(self)
}
}