Skip to main content

DoubleType

Trait DoubleType 

Source
pub trait DoubleType {
    type DoubleType: Word;

    // Required methods
    fn as_double(&self) -> Self::DoubleType;
    fn as_u64(&self) -> u64;
}
Expand description

Trait providing the double-width type for a given unsigned integer type.

This is used by crate::impls::BufBitReader to provide a bit buffer that is twice the width of the word read from the backend.

The methods as_double/as_u64 can be used to convert a word into its double-width type or to a u64, respectively, without loss of precision.

Required Associated Types§

Required Methods§

Source

fn as_double(&self) -> Self::DoubleType

Converts a word into its double-width type without loss of precision.

Source

fn as_u64(&self) -> u64

Converts a word into a u64 without loss of precision.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl DoubleType for u8

Source§

impl DoubleType for u16

Source§

impl DoubleType for u32

Source§

impl DoubleType for u64

Implementors§