pub enum BlockSizeRelation {
NearLt,
NearEq,
NearGt,
Far,
}Expand description
A type to represent relation between two block sizes.
Because the core comparison method can only compare two block hashes with the same block size, we cannot compare two fuzzy hashes if their block sizes are not near enough.
There are three cases where we can perform actual block hash comparison:
- Equals (
NearEq)
bs_a == bs_b - Less than (
NearLt)
bs_a < bs_b && bs_a * 2 == bs_b - Greater than (
NearGt)
bs_a > bs_b && bs_a == bs_b * 2
This type represents those near cases (three variants) and the case which
two fuzzy hashes cannot perform a block hash comparison, the far case
(the Far variant).
A value of this type can be retrieved by using
block_size::compare_sizes() or
FuzzyHashData::compare_block_sizes().
Note: in this crate, it can efficiently handle such relations by using the base-2 logarithms form of the block size (no multiplication required).
§Compatibility Note
Since the version 0.3, the representation of this enum is no longer specified as specific representation of this enum is not important.
Variants§
NearLt
Two block sizes are near and the block hash 2 (one with a larger block size) of the left side (of comparison) can be compared with the block hash 1 (one with a smaller block size) of the right side.
NearEq
Two block sizes are not just near but the same. We compare both block hashes with the other and take the maximum value for the output.
NearGt
Two block sizes are near and the block hash 1 (one with a smaller block size) of the left side (of comparison) can be compared with the block hash 2 (one with a larger block size) of the right side.
Far
Two block sizes are far and a block hash comparison cannot be performed.
Implementations§
Trait Implementations§
source§impl Clone for BlockSizeRelation
impl Clone for BlockSizeRelation
source§fn clone(&self) -> BlockSizeRelation
fn clone(&self) -> BlockSizeRelation
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for BlockSizeRelation
impl Debug for BlockSizeRelation
source§impl PartialEq for BlockSizeRelation
impl PartialEq for BlockSizeRelation
impl Copy for BlockSizeRelation
impl Eq for BlockSizeRelation
impl StructuralPartialEq for BlockSizeRelation
Auto Trait Implementations§
impl Freeze for BlockSizeRelation
impl RefUnwindSafe for BlockSizeRelation
impl Send for BlockSizeRelation
impl Sync for BlockSizeRelation
impl Unpin for BlockSizeRelation
impl UnwindSafe for BlockSizeRelation
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)