pub enum BlockSizeRelation {
NearLt,
NearEq,
NearGt,
Far,
}
Expand description
A type to represent relation between two block sizes.
Because the core comparison function can only compare two block hashes with the same effective 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
See also: “Relations with Block Size” section of FuzzyHashData
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()
.
§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
Near and less than (i.e. x < x * 2
).
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
Near and equals (i.e. x == x
).
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
Near and greater than (i.e. x * 2 > x
).
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
Far (e.g. x
and x * 4
).
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 more