diff --git a/src/bin.rs b/src/bin.rs index c72d00d..7e41d8d 100644 --- a/src/bin.rs +++ b/src/bin.rs @@ -161,7 +161,25 @@ impl CompareContextElement for serde_json::Value { } fn partial_compare(&self, other: &dyn ContextElement) -> Option { - // TODO: Implement + // Handle other serde_json::Value + match other.to_any().downcast_ref::() { + None => (), + Some(other_json_value) => return None, // TODO: Implement + } + // Handle string literals + match other.to_any().downcast_ref::() { + None => (), + Some(other_string) => { + return self + .as_str() + .map_or(None, |s| s.partial_cmp(other_string.as_str())) + } + } + // Handle numeric literals + match other.to_any().downcast_ref::() { + None => (), + Some(other_num) => return self.as_u64().map_or(None, |n| n.partial_cmp(other_num)), + } None } }