Skip to main content

EncodingSize

Trait EncodingSize 

Source
pub trait EncodingSize {
    // Required methods
    fn numerator_bits(&self) -> u32;
    fn denominator_bits(&self) -> u32;

    // Provided method
    fn encoding_bits(&self) -> u64 { ... }
}
Expand description

The size of a number’s representation, in bits.

Counted over the magnitude: the sign is not part of it, because it costs the same however large the value is.

§What implements it

The rational types of this crate. The primitive integers and the markers of fixed answer the same question trivially and are not implemented yet, so code that wants to measure a mixed set of coefficients cannot do so through this trait alone.

Required Methods§

Source

fn numerator_bits(&self) -> u32

Bits in the numerator.

Zero for the value zero, and the bit length of the magnitude otherwise.

Source

fn denominator_bits(&self) -> u32

Bits in the denominator.

One for a value that is an integer, whose denominator is one.

Provided Methods§

Source

fn encoding_bits(&self) -> u64

What it costs to store this value.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§