Trait FixedNumber

pub trait FixedNumber: Copy {
    type Type;

    // Required methods
    fn to_fixed(self) -> Self::Type;
    fn from_fixed(_: Self::Type) -> Self;
}
Expand description

A FixedNumber can be converted to a u32 or u64 type for use with fixed64 and fixed32 fields.

Required Associated Types§

type Type

The target type, u32 or u64.

Required Methods§

fn to_fixed(self) -> Self::Type

Converts to the fixed type.

fn from_fixed(_: Self::Type) -> Self

Converts from the fixed type.

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§

§

impl FixedNumber for f32

§

type Type = u32

§

fn to_fixed(self) -> u32

§

fn from_fixed(v: u32) -> f32

§

impl FixedNumber for f64

§

type Type = u64

§

fn to_fixed(self) -> u64

§

fn from_fixed(v: u64) -> f64

§

impl FixedNumber for i32

§

type Type = u32

§

fn to_fixed(self) -> u32

§

fn from_fixed(v: u32) -> i32

§

impl FixedNumber for i64

§

type Type = u64

§

fn to_fixed(self) -> u64

§

fn from_fixed(v: u64) -> i64

§

impl FixedNumber for u32

§

type Type = u32

§

fn to_fixed(self) -> u32

§

fn from_fixed(v: u32) -> u32

§

impl FixedNumber for u64

§

type Type = u64

§

fn to_fixed(self) -> u64

§

fn from_fixed(v: u64) -> u64

§

impl FixedNumber for Ipv4Addr

§

type Type = u32

§

fn to_fixed(self) -> u32

§

fn from_fixed(v: u32) -> Ipv4Addr

Implementors§