Crate bcmp [−] [src]
bcmp is a simple crate which offers data comparison mechanisms which go beyond the simple
equality. It only operates on byte slices, hence its name, and relies on efficiently finding
common substrings between two blob of data. The implementation relies on two different linear
time algorithms: a HashMap based algorithm called HashMatch and
a suffix tree built using Ukkonen algorithm called TreeMatch.
Examples
use bcmp::{AlgoSpec, MatchIterator}; let a = "abcdefg"; let b = "012abc34cdef56efg78abcdefg"; let match_iter = MatchIterator::new(a.as_bytes(), b.as_bytes(), AlgoSpec::HashMatch(2)); for m in match_iter { println!("Match: {:}", &a[m.first_pos..m.first_end()]); }
Modules
| hashmatch |
HashMatch is a binary matching algorithm based on a |
| treematch |
TreeMatch is a binary matching algorithm based on a suffix tree to retrieve matching strings. |
Structs
| Match |
A structure representing a matching substring between two pieces of data. |
| MatchIterator |
A generic wrapper for |
Enums
| AlgoSpec |
An enumeration describing the algorithm specification: either |
Functions
| longest_common_substring |
Return the longest common substring between two byte slices. |
| longest_common_substrings |
Return the |
| patch_set |
Identify the smallest set of patches needed the build the second byte slice from the first. |