Function fuzzyhash::fuzzyhash_compare
source · #[no_mangle]
pub unsafe extern "C" fn fuzzyhash_compare(
first: *const c_char,
second: *const c_char
) -> u32
Expand description
FFI Compatible fuzzy hash comparisons.
Arguments
first
- a C style fuzzy hash stringsecond
- a C style fuzzy hash string
Safety
This is function is unsafe
as it is intended to read strings from FFI
Example
use fuzzyhash::{fuzzyhash_compare};
use std::ffi::CString;
let first = CString::new("this is our test data for a fuzzy hash comparison!").unwrap();
let second = CString::new("this is my test data for a fuzzy hash comparison!").unwrap();
let compared = unsafe { fuzzyhash_compare(first.as_ptr(), second.as_ptr()) };
println!("Fuzzy Hash: {}", compared);
assert_eq!(compared, 17);