pub struct Blockhash64(/* private fields */);Expand description
A 64-bit hash digest.
See blockhash64.
Implementations§
Source§impl Blockhash64
impl Blockhash64
Sourcepub fn distance(&self, other: &Self) -> u32
pub fn distance(&self, other: &Self) -> u32
Returns the Hamming distance between two hashes.
§Examples
use blockhash::Blockhash64;
let a = Blockhash64::from([
0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef,
]);
let b = Blockhash64::from([
0xd0, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xff,
]);
assert_eq!(a.distance(&b), 4);Trait Implementations§
Source§impl Clone for Blockhash64
impl Clone for Blockhash64
Source§fn clone(&self) -> Blockhash64
fn clone(&self) -> Blockhash64
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Blockhash64
impl Debug for Blockhash64
Source§impl Display for Blockhash64
impl Display for Blockhash64
Source§impl From<Blockhash64> for [u8; 8]
impl From<Blockhash64> for [u8; 8]
Source§fn from(hash: Blockhash64) -> Self
fn from(hash: Blockhash64) -> Self
Converts to this type from the input type.
Source§impl From<Blockhash64> for u64
impl From<Blockhash64> for u64
Source§fn from(hash: Blockhash64) -> Self
fn from(hash: Blockhash64) -> Self
Converts to this type from the input type.
Source§impl From<u64> for Blockhash64
impl From<u64> for Blockhash64
Source§impl FromStr for Blockhash64
impl FromStr for Blockhash64
Source§impl Hash for Blockhash64
impl Hash for Blockhash64
Source§impl Ord for Blockhash64
impl Ord for Blockhash64
Source§fn cmp(&self, other: &Blockhash64) -> Ordering
fn cmp(&self, other: &Blockhash64) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for Blockhash64
impl PartialEq for Blockhash64
Source§impl PartialOrd for Blockhash64
impl PartialOrd for Blockhash64
impl Copy for Blockhash64
impl Eq for Blockhash64
impl StructuralPartialEq for Blockhash64
Auto Trait Implementations§
impl Freeze for Blockhash64
impl RefUnwindSafe for Blockhash64
impl Send for Blockhash64
impl Sync for Blockhash64
impl Unpin for Blockhash64
impl UnwindSafe for Blockhash64
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more