[−][src]Struct img_hash_median::ImageHash
A struct representing an image processed by a perceptual hash. For efficiency, does not retain a copy of the image data after hashing.
Get an instance with ImageHash::hash()
.
Implementations
impl<B: HashBytes> ImageHash<B>
[src]
pub fn as_bytes(&self) -> &[u8]
[src]
Get the bytes of this hash.
pub fn dist(&self, other: &Self) -> u32
[src]
Calculate the Hamming distance between this and other
.
Equivalent to counting the 1-bits of the XOR of the two hashes.
Essential to determining the perceived difference between self
and other
.
Note
This return value is meaningless if these two hashes are from different hash sizes or algorithms.
pub fn from_base64(encoded_hash: &str) -> Result<ImageHash<B>, DecodeError>
[src]
Create an ImageHash
instance from the given Base64-encoded string.
Errors:
Returns DecodeError::InvalidLength
if the decoded bytes can't fit in B
.
pub fn to_base64(&self) -> String
[src]
Get a Base64 string representing the bits of this hash.
Mostly for printing convenience.
Trait Implementations
impl<B: Clone> Clone for ImageHash<B>
[src]
impl<B: Debug> Debug for ImageHash<B>
[src]
impl<B: Eq> Eq for ImageHash<B>
[src]
impl<B: Hash> Hash for ImageHash<B>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<B: PartialEq> PartialEq<ImageHash<B>> for ImageHash<B>
[src]
impl<B> StructuralEq for ImageHash<B>
[src]
impl<B> StructuralPartialEq for ImageHash<B>
[src]
Auto Trait Implementations
impl<B> RefUnwindSafe for ImageHash<B> where
B: RefUnwindSafe,
B: RefUnwindSafe,
impl<B> Send for ImageHash<B> where
B: Send,
B: Send,
impl<B> Sync for ImageHash<B> where
B: Sync,
B: Sync,
impl<B> Unpin for ImageHash<B> where
B: Unpin,
B: Unpin,
impl<B> UnwindSafe for ImageHash<B> where
B: UnwindSafe,
B: UnwindSafe,
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> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
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>,