pub trait CheckedHammingDistance<RHS = Self> {
    fn checked_hamming_distance(self, other: RHS) -> Option<u64>;
}
Expand description

Returns the Hamming distance between two numbers, or the number of bit flips needed to turn one into the other.

This trait allows for the possibility of the distance being undefined for some pairs of numbers, in which case checked_hamming_distance should return None.

Required Methods

Implementations on Foreign Types

Returns the Hamming distance between two numbers, or the number of bit flips needed to turn one into the other.

If the two numbers have opposite signs, then the number of flips would be infinite, so the result is None.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Returns the Hamming distance between two numbers, or the number of bit flips needed to turn one into the other.

If the two numbers have opposite signs, then the number of flips would be infinite, so the result is None.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Returns the Hamming distance between two numbers, or the number of bit flips needed to turn one into the other.

If the two numbers have opposite signs, then the number of flips would be infinite, so the result is None.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Returns the Hamming distance between two numbers, or the number of bit flips needed to turn one into the other.

If the two numbers have opposite signs, then the number of flips would be infinite, so the result is None.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Returns the Hamming distance between two numbers, or the number of bit flips needed to turn one into the other.

If the two numbers have opposite signs, then the number of flips would be infinite, so the result is None.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Returns the Hamming distance between two numbers, or the number of bit flips needed to turn one into the other.

If the two numbers have opposite signs, then the number of flips would be infinite, so the result is None.

Worst-case complexity

Constant time and additional memory.

Examples

See here.

Implementors