Explorar o código

Added a missing is_bool for checking type

david hai 4 meses
pai
achega
31d8bb184c
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      src/data.rs

+ 4 - 0
src/data.rs

@@ -627,6 +627,10 @@ impl Data {
     pub fn is_string(&self) -> bool {
         matches!(self, Self::String(_))
     }
+    /// Is Data a bool
+    pub fn is_bool(&self) -> bool {
+        matches!(self, Self::Bool(_))
+    }
     /// Is Data a signed/unsigned integer or float
     ///
     /// JSON Number's can hold both a whole number (i.e. signed/unsigned integers) and floats