mesh_protobuf::encoding

Trait FromNumber

Source
pub trait FromNumber: Copy {
    // Required methods
    fn from_i64(v: i64) -> Result<Self>;
    fn from_u64(v: u64) -> Result<Self>;
}
Expand description

A trait for converting a value to from u64 for use in varint encodings.

N.B. The protobuf behavior is to truncate integers rather than fail on overflow.

Required Methods§

Source

fn from_i64(v: i64) -> Result<Self>

Convert from an i64.

Source

fn from_u64(v: u64) -> Result<Self>

Convert from a u64.

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 FromNumber for bool

Source§

fn from_u64(v: u64) -> Result<Self>

Source§

fn from_i64(v: i64) -> Result<Self>

Source§

impl FromNumber for char

Source§

fn from_u64(v: u64) -> Result<Self>

Source§

fn from_i64(v: i64) -> Result<Self>

Source§

impl FromNumber for i8

Source§

fn from_u64(v: u64) -> Result<Self>

Source§

fn from_i64(v: i64) -> Result<Self>

Source§

impl FromNumber for i16

Source§

fn from_u64(v: u64) -> Result<Self>

Source§

fn from_i64(v: i64) -> Result<Self>

Source§

impl FromNumber for i32

Source§

fn from_u64(v: u64) -> Result<Self>

Source§

fn from_i64(v: i64) -> Result<Self>

Source§

impl FromNumber for i64

Source§

fn from_u64(v: u64) -> Result<Self>

Source§

fn from_i64(v: i64) -> Result<Self>

Source§

impl FromNumber for isize

Source§

fn from_u64(v: u64) -> Result<Self>

Source§

fn from_i64(v: i64) -> Result<Self>

Source§

impl FromNumber for u8

Source§

fn from_u64(v: u64) -> Result<Self>

Source§

fn from_i64(v: i64) -> Result<Self>

Source§

impl FromNumber for u16

Source§

fn from_u64(v: u64) -> Result<Self>

Source§

fn from_i64(v: i64) -> Result<Self>

Source§

impl FromNumber for u32

Source§

fn from_u64(v: u64) -> Result<Self>

Source§

fn from_i64(v: i64) -> Result<Self>

Source§

impl FromNumber for u64

Source§

fn from_u64(v: u64) -> Result<Self>

Source§

fn from_i64(v: i64) -> Result<Self>

Source§

impl FromNumber for usize

Source§

fn from_u64(v: u64) -> Result<Self>

Source§

fn from_i64(v: i64) -> Result<Self>

Source§

impl FromNumber for NonZeroI8

Source§

fn from_u64(v: u64) -> Result<Self>

Source§

fn from_i64(v: i64) -> Result<Self>

Source§

impl FromNumber for NonZeroI16

Source§

fn from_u64(v: u64) -> Result<Self>

Source§

fn from_i64(v: i64) -> Result<Self>

Source§

impl FromNumber for NonZeroI32

Source§

fn from_u64(v: u64) -> Result<Self>

Source§

fn from_i64(v: i64) -> Result<Self>

Source§

impl FromNumber for NonZeroI64

Source§

fn from_u64(v: u64) -> Result<Self>

Source§

fn from_i64(v: i64) -> Result<Self>

Source§

impl FromNumber for NonZeroIsize

Source§

fn from_u64(v: u64) -> Result<Self>

Source§

fn from_i64(v: i64) -> Result<Self>

Source§

impl FromNumber for NonZeroU8

Source§

fn from_u64(v: u64) -> Result<Self>

Source§

fn from_i64(v: i64) -> Result<Self>

Source§

impl FromNumber for NonZeroU16

Source§

fn from_u64(v: u64) -> Result<Self>

Source§

fn from_i64(v: i64) -> Result<Self>

Source§

impl FromNumber for NonZeroU32

Source§

fn from_u64(v: u64) -> Result<Self>

Source§

fn from_i64(v: i64) -> Result<Self>

Source§

impl FromNumber for NonZeroU64

Source§

fn from_u64(v: u64) -> Result<Self>

Source§

fn from_i64(v: i64) -> Result<Self>

Source§

impl FromNumber for NonZeroUsize

Source§

fn from_u64(v: u64) -> Result<Self>

Source§

fn from_i64(v: i64) -> Result<Self>

Source§

impl<T: FromNumber> FromNumber for Wrapping<T>

Source§

fn from_u64(v: u64) -> Result<Self>

Source§

fn from_i64(v: i64) -> Result<Self>

Implementors§