Struct eudex::Difference [] [src]

pub struct Difference { /* fields omitted */ }

The difference between two words.

Methods

impl Difference
[src]

The "graduated" distance.

This will assign different weights to each of the bytes Hamming weight and simply add it. For most use cases, this metric is the preferred one.

Examples

use eudex::Hash;

println!("{}", (Hash::new("lulz") - Hash::new("lol")).dist());

The XOR distance.

This is generally not recommend unless you have a very specific reason to prefer it over the other methods provided.

Examples

use eudex::Hash;

println!("{}", (Hash::new("hello") - Hash::new("hellou")).xor())

The "flat" Hamming based distance.

This will let every byte carry the same weight, such that mismatch in the early and later mismatch counts the same.

Examples

use eudex::Hash;

println!("{}", (Hash::new("hello") - Hash::new("hellou")).hamming())

Does this difference constitute similarity?

Examples

use eudex::Hash;

assert!((Hash::new("hello") - Hash::new("hellou")).similar())

Trait Implementations

impl Copy for Difference
[src]

impl Clone for Difference
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more