Crate fossil_delta
source ·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
converts base 64 str to u32
converts integer to String in base 64
Creates delta and returns it as a String
see
generate_delta
Return the size (in bytes) of the output from applying
a delta.
Given the current version of text value
b_txt
and delta value as d_txt
this function returns the previous version of text b_txt.Return the number digits in the base-64 representation of a positive integer
Generate new delta in given mutable string reference