pub struct Blockhash144(/* private fields */);Expand description
A 144-bit hash digest.
See blockhash144.
Implementations§
Source§impl Blockhash144
impl Blockhash144
Sourcepub fn distance(&self, other: &Self) -> u32
pub fn distance(&self, other: &Self) -> u32
Returns the Hamming distance between two hashes.
§Examples
use blockhash::Blockhash144;
let a = Blockhash144::from([
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88,
0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x12, 0x34,
]);
let b = Blockhash144::from([
0x00, 0x11, 0x22, 0x33, 0x22, 0x55, 0x66, 0x77, 0x88,
0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xe7, 0xff, 0x12, 0x34,
]);
assert_eq!(a.distance(&b), 6);Trait Implementations§
Source§impl Clone for Blockhash144
impl Clone for Blockhash144
Source§fn clone(&self) -> Blockhash144
fn clone(&self) -> Blockhash144
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 Blockhash144
impl Debug for Blockhash144
Source§impl Display for Blockhash144
impl Display for Blockhash144
Source§impl From<Blockhash144> for [u8; 18]
impl From<Blockhash144> for [u8; 18]
Source§fn from(hash: Blockhash144) -> Self
fn from(hash: Blockhash144) -> Self
Converts to this type from the input type.
Source§impl FromStr for Blockhash144
impl FromStr for Blockhash144
Source§impl Hash for Blockhash144
impl Hash for Blockhash144
Source§impl Ord for Blockhash144
impl Ord for Blockhash144
Source§fn cmp(&self, other: &Blockhash144) -> Ordering
fn cmp(&self, other: &Blockhash144) -> 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 Blockhash144
impl PartialEq for Blockhash144
Source§impl PartialOrd for Blockhash144
impl PartialOrd for Blockhash144
impl Copy for Blockhash144
impl Eq for Blockhash144
impl StructuralPartialEq for Blockhash144
Auto Trait Implementations§
impl Freeze for Blockhash144
impl RefUnwindSafe for Blockhash144
impl Send for Blockhash144
impl Sync for Blockhash144
impl Unpin for Blockhash144
impl UnwindSafe for Blockhash144
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