Struct blockhash::Blockhash144
source · [−]pub struct Blockhash144(_);
Expand description
A 144-bit hash digest.
Implementations
sourceimpl 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
sourceimpl Clone for Blockhash144
impl Clone for Blockhash144
sourcefn clone(&self) -> Blockhash144
fn clone(&self) -> Blockhash144
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for Blockhash144
impl Debug for Blockhash144
sourceimpl Display for Blockhash144
impl Display for Blockhash144
sourceimpl From<Blockhash144> for [u8; 18]
impl From<Blockhash144> for [u8; 18]
sourcefn from(hash: Blockhash144) -> Self
fn from(hash: Blockhash144) -> Self
Converts to this type from the input type.
sourceimpl FromStr for Blockhash144
impl FromStr for Blockhash144
sourceimpl Hash for Blockhash144
impl Hash for Blockhash144
sourceimpl Ord for Blockhash144
impl Ord for Blockhash144
sourceimpl PartialEq<Blockhash144> for Blockhash144
impl PartialEq<Blockhash144> for Blockhash144
sourcefn eq(&self, other: &Blockhash144) -> bool
fn eq(&self, other: &Blockhash144) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &Blockhash144) -> bool
fn ne(&self, other: &Blockhash144) -> bool
This method tests for !=
.
sourceimpl PartialOrd<Blockhash144> for Blockhash144
impl PartialOrd<Blockhash144> for Blockhash144
sourcefn partial_cmp(&self, other: &Blockhash144) -> Option<Ordering>
fn partial_cmp(&self, other: &Blockhash144) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for Blockhash144
impl Eq for Blockhash144
impl StructuralEq for Blockhash144
impl StructuralPartialEq for Blockhash144
Auto Trait Implementations
impl RefUnwindSafe for Blockhash144
impl Send for Blockhash144
impl Sync for Blockhash144
impl Unpin for Blockhash144
impl UnwindSafe for Blockhash144
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more