json-rust
json-rust copied to clipboard
Implement `std::ops` for maths
Implement ops traits to make working with numbers easy:
let data = object!{ foo => 10 };
data["foo"] += 1;
assert_eq(data.dump(), r#"{"foo":11}"#);
~~I keep forgetting, this only works on the same types, so:~~
I've randomly looked into this again, and I was wrong (or right) about this. The math ops can be implemented for different types the same way PartialEq
can be.