28 lines
743 B
Rust
28 lines
743 B
Rust
|
|
use std::collections::HashMap;
|
||
|
|
|
||
|
|
use serde::Serialize;
|
||
|
|
|
||
|
|
use super::WasmAstNode;
|
||
|
|
|
||
|
|
#[derive(Debug, Serialize)]
|
||
|
|
pub enum AdditionalPropertyValue<'s, 'p> {
|
||
|
|
SingleString(&'s str),
|
||
|
|
ListOfStrings(Vec<&'s str>),
|
||
|
|
OptionalPair {
|
||
|
|
optval: Option<&'s str>,
|
||
|
|
val: &'s str,
|
||
|
|
},
|
||
|
|
ObjectTree(Vec<(Option<Vec<WasmAstNode<'s, 'p>>>, Vec<WasmAstNode<'s, 'p>>)>),
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(Debug, Serialize, Default)]
|
||
|
|
pub struct AdditionalProperties<'s, 'p> {
|
||
|
|
pub(crate) properties: HashMap<String, AdditionalPropertyValue<'s, 'p>>,
|
||
|
|
}
|
||
|
|
|
||
|
|
impl<'s, 'p> AdditionalProperties<'s, 'p> {
|
||
|
|
pub(crate) fn get_elisp_names<'c>(&'c self) -> impl Iterator<Item = String> + 'c {
|
||
|
|
self.properties.keys().map(move |key| format!(":{}", key))
|
||
|
|
}
|
||
|
|
}
|