pub struct BlockHashPositionArray { /* private fields */ }
Expand description
A simple struct representing a position array of a block hash.
This type is not a part of the FuzzyHashCompareTarget
struct but can be
a good example to use internal efficient implementation.
It’s (currently) used internally on the
FuzzyHashData::compare()
method
family (comparing two fuzzy hash objects) for the “shortcut path”
(when the block sizes are different but near).
See also:
§Compatibility Notice
This type is going to be completely private on the next major release. If you need to experiment with internal hashing functions, just vendor the source code for your needs.
Implementations§
Source§impl BlockHashPositionArray
impl BlockHashPositionArray
Sourcepub fn init_from(&mut self, blockhash: &[u8])
pub fn init_from(&mut self, blockhash: &[u8])
Clear and initialize (encode) the object from a given slice.
§Usage Constraints
- The length of
blockhash
must not exceed 64. - All elements in
blockhash
must be less thanblock_hash::ALPHABET_SIZE
.
Trait Implementations§
Source§impl BlockHashPositionArrayData for BlockHashPositionArray
impl BlockHashPositionArrayData for BlockHashPositionArray
Source§fn representation(&self) -> &[u64; 64]
fn representation(&self) -> &[u64; 64]
Returns the raw representation of the block hash position array.
Source§fn is_valid(&self) -> bool
fn is_valid(&self) -> bool
Performs full validity checking of a position array object. Read more
Source§fn is_valid_and_normalized(&self) -> bool
fn is_valid_and_normalized(&self) -> bool
Performs full validity checking and the normalization test
of a position array object. Read more
Source§impl Debug for BlockHashPositionArray
impl Debug for BlockHashPositionArray
Source§impl Default for BlockHashPositionArray
impl Default for BlockHashPositionArray
Source§impl PartialEq for BlockHashPositionArray
impl PartialEq for BlockHashPositionArray
impl Eq for BlockHashPositionArray
impl StructuralPartialEq for BlockHashPositionArray
Auto Trait Implementations§
impl Freeze for BlockHashPositionArray
impl RefUnwindSafe for BlockHashPositionArray
impl Send for BlockHashPositionArray
impl Sync for BlockHashPositionArray
impl Unpin for BlockHashPositionArray
impl UnwindSafe for BlockHashPositionArray
Blanket Implementations§
Source§impl<T> BlockHashPositionArrayImpl for Twhere
T: BlockHashPositionArrayImplInternal,
impl<T> BlockHashPositionArrayImpl for Twhere
T: BlockHashPositionArrayImplInternal,
Source§fn is_equiv(&self, other: &[u8]) -> bool
fn is_equiv(&self, other: &[u8]) -> bool
Compare whether two block hashes are equivalent. Read more
Source§fn has_common_substring(&self, other: &[u8]) -> bool
fn has_common_substring(&self, other: &[u8]) -> bool
Checks whether two given strings have common substrings with a length
of
block_hash::MIN_LCS_FOR_COMPARISON
. Read moreSource§fn edit_distance(&self, other: &[u8]) -> u32
fn edit_distance(&self, other: &[u8]) -> u32
Computes the edit distance between two given strings. Read more
Source§impl<T> BlockHashPositionArrayImplUnchecked for Twhere
T: BlockHashPositionArrayImplInternal,
impl<T> BlockHashPositionArrayImplUnchecked for Twhere
T: BlockHashPositionArrayImplInternal,
Source§unsafe fn is_equiv_unchecked(&self, other: &[u8]) -> bool
unsafe fn is_equiv_unchecked(&self, other: &[u8]) -> bool
Available on crate feature
unchecked
only.Compare whether two block hashes are equivalent. Read more
Source§unsafe fn has_common_substring_unchecked(&self, other: &[u8]) -> bool
unsafe fn has_common_substring_unchecked(&self, other: &[u8]) -> bool
Available on crate feature
unchecked
only.Checks whether two given strings have common substrings with a length
of
block_hash::MIN_LCS_FOR_COMPARISON
. Read moreSource§unsafe fn edit_distance_unchecked(&self, other: &[u8]) -> u32
unsafe fn edit_distance_unchecked(&self, other: &[u8]) -> u32
Available on crate feature
unchecked
only.Computes the edit distance between two given strings. Read more
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