|
@@ -499,30 +499,19 @@ impl Data {
|
|
///
|
|
///
|
|
/// JSON Number's can hold both a whole number (i.e. signed/unsigned integers) and floats
|
|
/// JSON Number's can hold both a whole number (i.e. signed/unsigned integers) and floats
|
|
pub fn is_number(&self) -> bool {
|
|
pub fn is_number(&self) -> bool {
|
|
- match self {
|
|
|
|
- Self::I8(_) | Self::I16(_) | Self::I32(_) | Self::I64(_) | Self::I128(_) => true,
|
|
|
|
- Self::U8(_) | Self::U16(_) | Self::U32(_) | Self::U64(_) | Self::U128(_) => true,
|
|
|
|
- Self::F32(_) | Self::F64(_) => true,
|
|
|
|
- _ => false
|
|
|
|
- }
|
|
|
|
|
|
+ matches!(self, Self::I8(_) | Self::I16(_) | Self::I32(_) | Self::I64(_) | Self::I128(_) | Self::U8(_) | Self::U16(_) | Self::U32(_) | Self::U64(_) | Self::U128(_) | Self::F32(_) | Self::F64(_))
|
|
}
|
|
}
|
|
/// Is Data a signed integer (Regardless of bits)
|
|
/// Is Data a signed integer (Regardless of bits)
|
|
///
|
|
///
|
|
/// i.e. i8, i16, i32, i64, i128 or neither
|
|
/// i.e. i8, i16, i32, i64, i128 or neither
|
|
pub fn is_int(&self) -> bool {
|
|
pub fn is_int(&self) -> bool {
|
|
- match self {
|
|
|
|
- Self::I8(_) | Self::I16(_) | Self::I32(_) | Self::I64(_) | Self::I128(_) => true,
|
|
|
|
- _ => false
|
|
|
|
- }
|
|
|
|
|
|
+ matches!(self, Self::I8(_) | Self::I16(_) | Self::I32(_) | Self::I64(_) | Self::I128(_))
|
|
}
|
|
}
|
|
/// Is Data a unsigned integer (Regardless of bits)
|
|
/// Is Data a unsigned integer (Regardless of bits)
|
|
///
|
|
///
|
|
/// i.e. u8, u16, u32, u64, or u128 or neither
|
|
/// i.e. u8, u16, u32, u64, or u128 or neither
|
|
pub fn is_uint(&self) -> bool {
|
|
pub fn is_uint(&self) -> bool {
|
|
- match self {
|
|
|
|
- Self::U8(_) | Self::U16(_) | Self::U32(_) | Self::U64(_) | Self::U128(_) => true,
|
|
|
|
- _ => false
|
|
|
|
- }
|
|
|
|
|
|
+ matches!(self, Self::U8(_) | Self::U16(_) | Self::U32(_) | Self::U64(_) | Self::U128(_))
|
|
}
|
|
}
|
|
/// Is Data a f32 or f64 or neither
|
|
/// Is Data a f32 or f64 or neither
|
|
pub fn is_float(&self) -> bool {
|
|
pub fn is_float(&self) -> bool {
|