Browse Source

Added a missing is_bool for checking type

david 4 months ago
parent
commit
31d8bb184c
1 changed files with 4 additions and 0 deletions
  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