pub trait Radix {
const RADIX_BITS: u32;
// Required method
fn radix_similarity(&self, other: &Self) -> u32;
// Provided method
fn radix_distance(&self, other: &Self) -> u32 { ... }
}
Expand description
A number that can be compared using radix distance
Required Associated Constants§
Sourceconst RADIX_BITS: u32
const RADIX_BITS: u32
The value returned by radix_similarty
if all bits are equal
Required Methods§
Sourcefn radix_similarity(&self, other: &Self) -> u32
fn radix_similarity(&self, other: &Self) -> u32
The number of high bits in a row that this and other
has in common
Eg. the radix similarity of 001001 and 000001 is 2 because they share the 2 high bits.
Provided Methods§
Sourcefn radix_distance(&self, other: &Self) -> u32
fn radix_distance(&self, other: &Self) -> u32
Opposite of radix_similarity
. If radix_distance
returns 0, then radix_similarity
returns radix_bits
and vice versa.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.