|
@@ -2,6 +2,7 @@ use std::{collections::HashMap, fmt::Display, slice::{SliceIndex, Iter, IterMut}
|
|
|
|
|
|
use crate::Shared;
|
|
|
|
|
|
+#[cfg(not(feature = "serde"))]
|
|
|
#[derive(Debug, PartialEq, Clone)]
|
|
|
pub enum Data {
|
|
|
None,
|
|
@@ -23,6 +24,28 @@ pub enum Data {
|
|
|
Map(HashMap<String, Data>),
|
|
|
}
|
|
|
|
|
|
+#[cfg(feature="serde")]
|
|
|
+#[derive(Debug, PartialEq, Clone, serde::Serialize, serde::Deserialize)]
|
|
|
+pub enum Data {
|
|
|
+ None,
|
|
|
+ String(String),
|
|
|
+ I8(i8),
|
|
|
+ I16(i16),
|
|
|
+ I32(i32),
|
|
|
+ I64(i64),
|
|
|
+ I128(i128),
|
|
|
+ U8(u8),
|
|
|
+ U16(u16),
|
|
|
+ U32(u32),
|
|
|
+ U64(u64),
|
|
|
+ U128(u128),
|
|
|
+ F32(f32),
|
|
|
+ F64(f64),
|
|
|
+ Bool(bool),
|
|
|
+ Vec(Vec<Data>),
|
|
|
+ Map(HashMap<String, Data>),
|
|
|
+}
|
|
|
+
|
|
|
impl Default for Data {
|
|
|
fn default() -> Self {
|
|
|
Self::None
|