[][src]Crate fossil_delta

Implementation of the delta algorithm used by fossil version control system.

use fossil_delta::{delta, deltainv};
let a = r#"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 = r#"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);

Functions

b64str

converts integer to String in base 64

b64int

converts base 64 str to u32

b64int_read
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 as d_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