Trait Radix

Source
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§

Source

const RADIX_BITS: u32

The value returned by radix_similarty if all bits are equal

Required Methods§

Source

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§

Source

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.

Implementations on Foreign Types§

Source§

impl Radix for i8

Source§

const RADIX_BITS: u32 = 8u32

Source§

fn radix_similarity(&self, other: &i8) -> u32

Source§

impl Radix for i16

Source§

const RADIX_BITS: u32 = 16u32

Source§

fn radix_similarity(&self, other: &i16) -> u32

Source§

impl Radix for i32

Source§

const RADIX_BITS: u32 = 32u32

Source§

fn radix_similarity(&self, other: &i32) -> u32

Source§

impl Radix for i64

Source§

const RADIX_BITS: u32 = 64u32

Source§

fn radix_similarity(&self, other: &i64) -> u32

Source§

impl Radix for i128

Source§

const RADIX_BITS: u32 = 128u32

Source§

fn radix_similarity(&self, other: &i128) -> u32

Source§

impl Radix for isize

Source§

const RADIX_BITS: u32 = 64u32

Source§

fn radix_similarity(&self, other: &isize) -> u32

Source§

impl Radix for u8

Source§

const RADIX_BITS: u32 = 8u32

Source§

fn radix_similarity(&self, other: &u8) -> u32

Source§

impl Radix for u16

Source§

const RADIX_BITS: u32 = 16u32

Source§

fn radix_similarity(&self, other: &u16) -> u32

Source§

impl Radix for u32

Source§

const RADIX_BITS: u32 = 32u32

Source§

fn radix_similarity(&self, other: &u32) -> u32

Source§

impl Radix for u64

Source§

const RADIX_BITS: u32 = 64u32

Source§

fn radix_similarity(&self, other: &u64) -> u32

Source§

impl Radix for u128

Source§

const RADIX_BITS: u32 = 128u32

Source§

fn radix_similarity(&self, other: &u128) -> u32

Source§

impl Radix for ()

Source§

const RADIX_BITS: u32 = 0u32

Source§

fn radix_similarity(&self, _: &()) -> u32

Source§

impl Radix for usize

Source§

const RADIX_BITS: u32 = 64u32

Source§

fn radix_similarity(&self, other: &usize) -> u32

Source§

impl Radix for NotNan<f32>

Source§

const RADIX_BITS: u32 = 32u32

Source§

fn radix_similarity(&self, other: &NotNan<f32>) -> u32

Source§

impl Radix for NotNan<f64>

Source§

const RADIX_BITS: u32 = 64u32

Source§

fn radix_similarity(&self, other: &NotNan<f64>) -> u32

Source§

impl<A: Radix> Radix for (A,)

Source§

impl<A: Radix, B: Radix> Radix for (A, B)

Source§

impl<A: Radix, B: Radix, C: Radix> Radix for (A, B, C)

Source§

impl<A: Radix, B: Radix, C: Radix, D: Radix> Radix for (A, B, C, D)

Source§

impl<A: Radix, B: Radix, C: Radix, D: Radix, E: Radix> Radix for (A, B, C, D, E)

Source§

impl<A: Radix, B: Radix, C: Radix, D: Radix, E: Radix, F: Radix> Radix for (A, B, C, D, E, F)

Source§

impl<A: Radix, B: Radix, C: Radix, D: Radix, E: Radix, F: Radix, G: Radix> Radix for (A, B, C, D, E, F, G)

Source§

impl<A: Radix, B: Radix, C: Radix, D: Radix, E: Radix, F: Radix, G: Radix, H: Radix> Radix for (A, B, C, D, E, F, G, H)

Source§

impl<A: Radix, B: Radix, C: Radix, D: Radix, E: Radix, F: Radix, G: Radix, H: Radix, I: Radix> Radix for (A, B, C, D, E, F, G, H, I)

Source§

impl<A: Radix, B: Radix, C: Radix, D: Radix, E: Radix, F: Radix, G: Radix, H: Radix, I: Radix, J: Radix> Radix for (A, B, C, D, E, F, G, H, I, J)

Source§

impl<A: Radix, B: Radix, C: Radix, D: Radix, E: Radix, F: Radix, G: Radix, H: Radix, I: Radix, J: Radix, K: Radix> Radix for (A, B, C, D, E, F, G, H, I, J, K)

Source§

impl<A: Radix, B: Radix, C: Radix, D: Radix, E: Radix, F: Radix, G: Radix, H: Radix, I: Radix, J: Radix, K: Radix, L: Radix> Radix for (A, B, C, D, E, F, G, H, I, J, K, L)

Source§

impl<T: Radix> Radix for Reverse<T>

Source§

const RADIX_BITS: u32 = T::RADIX_BITS

Source§

fn radix_similarity(&self, other: &Reverse<T>) -> u32

Source§

impl<T: Radix> Radix for Wrapping<T>

Source§

const RADIX_BITS: u32 = T::RADIX_BITS

Source§

fn radix_similarity(&self, other: &Wrapping<T>) -> u32

Implementors§