dochy_diff 0.6.0

Calculates Dochy Diff.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use dochy_core::structs::RootObject;
use crate::diff_error::DiffError;
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;
use dochy_compaction::enc_dec::decode::decode;


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(())
}