pub fn hamming(a: &str, b: &str) -> Result<u32, LengthMismatchError>Expand description
Hamming distance computations
Calculate the number of substitutions required to change one string into the other.
§Example
use stringmetrics::hamming;
use stringmetrics::errors::LengthMismatchError;
assert_eq!(hamming("abcdefg", "aaadefa"), Ok(3));
assert_eq!(hamming("abcdefg", "xaaadefa"), Err(LengthMismatchError));§Errors
Returns a LengthMismatchError if the two elements are not of the same
length