mesh_protobuf::encoding

Trait FixedNumber

Source
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§

Source

type Type

The target type, u32 or u64.

Required Methods§

Source

fn to_fixed(self) -> Self::Type

Converts to the fixed type.

Source

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§

Source§

impl FixedNumber for f32

Source§

type Type = u32

Source§

fn to_fixed(self) -> u32

Source§

fn from_fixed(v: u32) -> Self

Source§

impl FixedNumber for f64

Source§

type Type = u64

Source§

fn to_fixed(self) -> u64

Source§

fn from_fixed(v: u64) -> Self

Source§

impl FixedNumber for i32

Source§

type Type = u32

Source§

fn to_fixed(self) -> u32

Source§

fn from_fixed(v: u32) -> Self

Source§

impl FixedNumber for i64

Source§

type Type = u64

Source§

fn to_fixed(self) -> u64

Source§

fn from_fixed(v: u64) -> Self

Source§

impl FixedNumber for u32

Source§

type Type = u32

Source§

fn to_fixed(self) -> u32

Source§

fn from_fixed(v: u32) -> Self

Source§

impl FixedNumber for u64

Source§

type Type = u64

Source§

fn to_fixed(self) -> u64

Source§

fn from_fixed(v: u64) -> Self

Implementors§