dochy_diff 0.1.0

Calculates the diff of two Dochy Data.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use dochy_core::structs::RootObject;
use crate::diff_error::DiffError;
use dochy_compaction::{decode};
use crate::imp::read::reader::Reader;
use crate::imp::read::read_root::read_root;
use crate::imp::apply::apply_root_diff::apply_root_diff;
use std::io::Read;

pub fn apply_diff<R : Read>(root : &mut RootObject, diff : &mut R) -> Result<(), DiffError>{
    let (diff, _size) = decode(diff)?;
    let mut reader = Reader::new(diff);
    let diff = read_root(&mut reader, root.meta_table())?;
    apply_root_diff(root, diff)?;
    Ok(())
}