tenda_runtime/
associative_array.rs

1use std::fmt;
2use std::fmt::Display;
3
4use crate::value::Value;
5
6pub type AssociativeArray = indexmap::IndexMap<AssociativeArrayKey, Value>;
7
8#[derive(Debug, Clone, Hash, Eq, PartialEq)]
9pub enum AssociativeArrayKey {
10    String(String),
11    Number(i64),
12}
13
14impl Display for AssociativeArrayKey {
15    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
16        match self {
17            AssociativeArrayKey::String(key) => write!(f, "{}", key),
18            AssociativeArrayKey::Number(key) => write!(f, "{}", key),
19        }
20    }
21}