Pārlūkot izejas kodu

Added a missing is_bool for checking type

david 4 mēneši atpakaļ
vecāks
revīzija
31d8bb184c
1 mainītis faili ar 4 papildinājumiem un 0 dzēšanām
  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