Taking into account additional property names but not comparing their values.

This commit is contained in:
Tom Alexander
2023-12-27 18:01:56 -05:00
parent a5e108bc37
commit f050e9b6a8
4 changed files with 67 additions and 11 deletions

View File

@@ -0,0 +1,27 @@
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))
}
}