diff --git a/src/value/value.rs b/src/value/value.rs index 25655cd..9aefbb9 100644 --- a/src/value/value.rs +++ b/src/value/value.rs @@ -23,7 +23,7 @@ pub type Dict = Map; /// let v = Value::from("hello"); /// assert_eq!(v.as_str(), Some("hello")); /// ``` -#[derive(Debug, Clone)] +#[derive(Clone)] pub enum Value { /// A string. String(Tag, String), @@ -421,6 +421,20 @@ impl Value { } } +impl std::fmt::Debug for Value { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::String(_, v) => f.debug_tuple("String").field(v).finish(), + Self::Char(_, v) => f.debug_tuple("Char").field(v).finish(), + Self::Bool(_, v) => f.debug_tuple("Bool").field(v).finish(), + Self::Num(_, v) => f.debug_tuple("Num").field(v).finish(), + Self::Empty(_, v) => f.debug_tuple("Empty").field(v).finish(), + Self::Dict(_, v) => f.debug_tuple("Dict").field(v).finish(), + Self::Array(_, v) => f.debug_tuple("Array").field(v).finish(), + } + } +} + impl PartialEq for Value { fn eq(&self, other: &Self) -> bool { match (self, other) {