Add support for negative integers.
This commit is contained in:
@@ -335,6 +335,11 @@ impl CompareContextElement for serde_json::Value {
|
||||
return self
|
||||
.equals(&serde_json::Value::Number(other_json_num) as &dyn ContextElement);
|
||||
}
|
||||
Some(OwnedLiteral::LNegativeInteger(other_num)) => {
|
||||
let other_json_num: serde_json::Number = std::convert::From::from(*other_num);
|
||||
return self
|
||||
.equals(&serde_json::Value::Number(other_json_num) as &dyn ContextElement);
|
||||
}
|
||||
Some(OwnedLiteral::LFloat(other_num)) => {
|
||||
let other_json_num = serde_json::Number::from_f64(*other_num);
|
||||
match other_json_num {
|
||||
@@ -463,6 +468,7 @@ impl From<&OwnedLiteral> for JsonNumber {
|
||||
fn from(original: &OwnedLiteral) -> Self {
|
||||
match original {
|
||||
OwnedLiteral::LPositiveInteger(num) => JsonNumber::UnsignedInteger(*num),
|
||||
OwnedLiteral::LNegativeInteger(num) => JsonNumber::SignedInteger(*num),
|
||||
OwnedLiteral::LString(text) => text.into(),
|
||||
OwnedLiteral::LFloat(num) => {
|
||||
if num.is_nan() {
|
||||
|
||||
Reference in New Issue
Block a user