Struct blockhash::Blockhash64
source · [−]pub struct Blockhash64(_);
Expand description
A 64-bit hash digest.
Implementations
sourceimpl 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
sourceimpl Clone for Blockhash64
impl Clone for Blockhash64
sourcefn clone(&self) -> Blockhash64
fn clone(&self) -> Blockhash64
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 Blockhash64
impl Debug for Blockhash64
sourceimpl Display for Blockhash64
impl Display for Blockhash64
sourceimpl From<Blockhash64> for [u8; 8]
impl From<Blockhash64> for [u8; 8]
sourcefn from(hash: Blockhash64) -> Self
fn from(hash: Blockhash64) -> Self
Converts to this type from the input type.
sourceimpl From<Blockhash64> for u64
impl From<Blockhash64> for u64
sourcefn from(hash: Blockhash64) -> Self
fn from(hash: Blockhash64) -> Self
Converts to this type from the input type.
sourceimpl From<u64> for Blockhash64
impl From<u64> for Blockhash64
sourceimpl FromStr for Blockhash64
impl FromStr for Blockhash64
sourceimpl Hash for Blockhash64
impl Hash for Blockhash64
sourceimpl Ord for Blockhash64
impl Ord for Blockhash64
sourceimpl PartialEq<Blockhash64> for Blockhash64
impl PartialEq<Blockhash64> for Blockhash64
sourcefn eq(&self, other: &Blockhash64) -> bool
fn eq(&self, other: &Blockhash64) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &Blockhash64) -> bool
fn ne(&self, other: &Blockhash64) -> bool
This method tests for !=
.
sourceimpl PartialOrd<Blockhash64> for Blockhash64
impl PartialOrd<Blockhash64> for Blockhash64
sourcefn partial_cmp(&self, other: &Blockhash64) -> Option<Ordering>
fn partial_cmp(&self, other: &Blockhash64) -> 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 Blockhash64
impl Eq for Blockhash64
impl StructuralEq for Blockhash64
impl StructuralPartialEq for Blockhash64
Auto Trait Implementations
impl RefUnwindSafe for Blockhash64
impl Send for Blockhash64
impl Sync for Blockhash64
impl Unpin for Blockhash64
impl UnwindSafe for Blockhash64
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)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more