1use std::fmt::Display;
2
3#[derive(Debug, Clone, PartialEq)]
4pub enum ObjectKey {
5 Identifier(String),
6 String(String),
7}
8
9impl ObjectKey {
10 pub fn is_identifier(&self) -> bool {
11 matches!(self, ObjectKey::Identifier(_))
12 }
13
14 pub fn is_string(&self) -> bool {
15 matches!(self, ObjectKey::String(_))
16 }
17}
18
19impl Display for ObjectKey {
20 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
21 match self {
22 ObjectKey::Identifier(id) => write!(f, "{}", id),
23 ObjectKey::String(str) => write!(f, "\"{}\"", str),
24 }
25 }
26}