Struct eudex::Difference
[−]
[src]
pub struct Difference { /* fields omitted */ }
The difference between two words.
Methods
impl Difference
[src]
fn dist(self) -> u32
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());
fn xor(self) -> u64
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())
fn hamming(self) -> u32
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())
fn similar(self) -> bool
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]
fn clone(&self) -> Difference
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more