pub struct Diff { /* private fields */ }Expand description
Use DiffBuilder to build Diff first and run Diff::compare to get the
difference between two JSON values.
Implementations§
Source§impl Diff
impl Diff
Sourcepub fn compare(self) -> Option<Difference>
pub fn compare(self) -> Option<Difference>
Examples found in repository?
examples/simple_object_diff.rs (line 17)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
fn main() {
let obj1 = serde_json::json!({
"user": "John",
"age": 31
});
let obj2 = serde_json::json!({
"user": "John",
"age": 33
});
let diff = sjdiff::DiffBuilder::default()
.source(obj1)
.target(obj2)
.build()
.unwrap();
let diff = diff.compare();
serde_json::to_writer_pretty(std::io::stdout(), &diff).unwrap();
}Trait Implementations§
Auto Trait Implementations§
impl Freeze for Diff
impl RefUnwindSafe for Diff
impl Send for Diff
impl Sync for Diff
impl Unpin for Diff
impl UnwindSafe for Diff
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more