[−][src]Struct fuzzyhash::FuzzyHash
Hasher for fuzzy algorithm
Implementations
impl FuzzyHash
[src]
pub fn new<S: AsRef<[u8]>>(input: S) -> Self
[src]
Construct a new FuzzyHash from source data
Example
use std::fs::read; use std::io::Read; use fuzzyhash::FuzzyHash; let mut data = read("/usr/bin/bash").unwrap(); let mut fuzzy_hash = FuzzyHash::new(data);
pub fn file<P: AsRef<Path>>(path: P) -> Result<Self, Error>
[src]
Hash a file pointed to by path
.
Example
use fuzzyhash::{FuzzyHash}; let hash = FuzzyHash::file("/home/me/a_large_file.bin").unwrap();
pub fn read<R: Read>(reader: &mut R) -> Result<Self, Error>
[src]
Hash target implementing std::io::Read
Example
use fuzzyhash::FuzzyHash; use std::io::{Cursor, Read}; let mut cursor = Cursor::new(vec![1,2,3,4,5,6,7,8,9,10]); let fuzzy = FuzzyHash::read(&mut cursor);
pub fn update<S: AsRef<[u8]>>(&mut self, input: S)
[src]
Add chunk to the data source
pub fn finalize(&mut self)
[src]
Called to finalize the hashing and generate a string value
pub fn compare<S: AsRef<str>, T: AsRef<str>>(first: S, second: T) -> Result<u32>
[src]
Compare two fuzzy hashes
Arguments
first
- first fuzzy hash to comparesecond
- second fuzzy hash to compare
Example
use fuzzyhash::FuzzyHash; assert_eq!(FuzzyHash::compare( "96:U57GjXnLt9co6pZwvLhJluvrszNgMFwO6MFG8SvkpjTWf:Hj3BeoEcNJ0TspgIG8SvkpjTg", "96:U57GjXnLt9co6pZwvLhJluvrs1eRTxYARdEallia:Hj3BeoEcNJ0TsI9xYeia3R").unwrap(), 63);
pub fn compare_to(&self, other: &FuzzyHash) -> Option<u32>
[src]
Compare this fuzzy hash against another
Arguments
other
- compare this fuzzy hash toother
Example
use fuzzyhash::FuzzyHash; let mut fuzzy_hash = FuzzyHash::new("some data to hash for the purposes of running a test"); assert_eq!(fuzzy_hash.compare_to( &"3:HEREar5MFUul0U0KMP:knl8lkKMP".into()), Some(18));
Trait Implementations
impl Default for FuzzyHash
[src]
impl Display for FuzzyHash
[src]
impl From<&'_ str> for FuzzyHash
[src]
impl From<String> for FuzzyHash
[src]
Auto Trait Implementations
impl RefUnwindSafe for FuzzyHash
[src]
impl Send for FuzzyHash
[src]
impl Sync for FuzzyHash
[src]
impl Unpin for FuzzyHash
[src]
impl UnwindSafe for FuzzyHash
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,