Expand description
Implementation of the delta algorithm used by fossil version control system.
use fossil_delta::{delta, deltainv};
let a = b"line 1
yet another (a bit longer) line 2
yet another (a bit longer) line 3
yet another (a bit longer) line 4
yet another (a bit longer) line 5
yet another (a bit longer) line 6
yet another (a bit longer) line 7
yet another (a bit longer) line 8
yet another (a bit longer) line 9
yet another (a bit longer) line 10";
let b = b"line 1
yet another (a bit longer) line 2
yet another (a bit longer) line 3
yet another (a bit longer) line 4
yet another (a bit longer) line 5
yet another (a bit longer) line 6
yet another (a bit longer) line 6 1/2
yet another (a bit longer) line 7
yet another (a bit longer) line 8
yet another (a bit longer) line 9
and finally last line 10";
let d = delta(a, b);
let s = deltainv(b, &d);
assert_eq!(&s, a);
assert_eq!(d.len(), 43);
Enums§
Functions§
- apply
- b64int
- converts base 64 str to u32
- b64int_
read - b64str
- converts integer to String in base 64
- delta
- Creates delta and returns it as a String
see
generate_delta
- delta_
output_ size - Return the size (in bytes) of the output from applying a delta.
- deltainv
- Given the current version of text value
b_txt
and delta value asd_txt
this function returns the previous version of text b_txt. - digit_
count - Return the number digits in the base-64 representation of a positive integer
- generate_
delta - Generate new delta in given mutable string reference