Trait AsBits

Source
pub trait AsBits {
    type Bits: Bits;

    // Required methods
    fn to_bits(self) -> Self::Bits;
    fn from_bits(b: Self::Bits) -> Self;
}
Expand description

Conversions to and from bit representations.

Required Associated Types§

Source

type Bits: Bits

Type for the bit representation of Self.

Required Methods§

Source

fn to_bits(self) -> Self::Bits

Convert to the underlying bit representation.

Source

fn from_bits(b: Self::Bits) -> Self

Convert from the underlying bit representation.

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 AsBits for f32

Source§

type Bits = u32

Source§

fn to_bits(self) -> Self::Bits

Source§

fn from_bits(b: Self::Bits) -> Self

Source§

impl AsBits for f64

Source§

type Bits = u64

Source§

fn to_bits(self) -> Self::Bits

Source§

fn from_bits(b: Self::Bits) -> Self

Implementors§