BitWidthConvertible

Trait BitWidthConvertible 

Source
pub trait BitWidthConvertible {
    type Width32;
    type Width64;

    // Required methods
    fn to32(self) -> Self::Width32;
    fn to64(self) -> Self::Width64;
    fn from32(width32: Self::Width32) -> Self;
    fn from64(width64: Self::Width64) -> Self;
}
Expand description

A trait for converting between different bit-width representations.

Required Associated Types§

Source

type Width32

The 32-bit width representation of the type.

Source

type Width64

The 64-bit width representation of the type.

Required Methods§

Source

fn to32(self) -> Self::Width32

Converts the type into its 32-bit width representation.

Source

fn to64(self) -> Self::Width64

Converts the type into its 64-bit width representation.

Source

fn from32(width32: Self::Width32) -> Self

Constructs the type from a 32-bit width representation.

Source

fn from64(width64: Self::Width64) -> Self

Constructs the type from a 64-bit width 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 BitWidthConvertible for f32

Source§

type Width32 = f32

Source§

type Width64 = f64

Source§

fn to32(self) -> Self::Width32

Source§

fn to64(self) -> Self::Width64

Source§

fn from32(width32: Self::Width32) -> Self

Source§

fn from64(width64: Self::Width64) -> Self

Source§

impl BitWidthConvertible for f64

Source§

type Width32 = f32

Source§

type Width64 = f64

Source§

fn to32(self) -> Self::Width32

Source§

fn to64(self) -> Self::Width64

Source§

fn from32(width32: Self::Width32) -> Self

Source§

fn from64(width64: Self::Width64) -> Self

Implementors§