pub trait HasUnsignedVersion {
    type Unsigned;
    type LeBytes;

    // Required methods
    fn to_le_bytes(self) -> Self::LeBytes;
    fn from_le_bytes(bytes: Self::LeBytes) -> Self;
}
Expand description

Helper trait for efficient calculations in other implementations

Required Associated Types§

source

type Unsigned

which unsigned type corresponds to this type?

source

type LeBytes

Type returned by self.to_le_bytes(). Depends on how many bytes are needed, to represent the number

Required Methods§

source

fn to_le_bytes(self) -> Self::LeBytes

to little endian. See implementation for integers in the standard library

source

fn from_le_bytes(bytes: Self::LeBytes) -> Self

from little endian. See implementation for integers in the standard library

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl HasUnsignedVersion for i8

§

type Unsigned = u8

§

type LeBytes = [u8; 1]

source§

fn to_le_bytes(self) -> Self::LeBytes

source§

fn from_le_bytes(bytes: Self::LeBytes) -> Self

source§

impl HasUnsignedVersion for i16

§

type Unsigned = u16

§

type LeBytes = [u8; 2]

source§

fn to_le_bytes(self) -> Self::LeBytes

source§

fn from_le_bytes(bytes: Self::LeBytes) -> Self

source§

impl HasUnsignedVersion for i32

§

type Unsigned = u32

§

type LeBytes = [u8; 4]

source§

fn to_le_bytes(self) -> Self::LeBytes

source§

fn from_le_bytes(bytes: Self::LeBytes) -> Self

source§

impl HasUnsignedVersion for i64

§

type Unsigned = u64

§

type LeBytes = [u8; 8]

source§

fn to_le_bytes(self) -> Self::LeBytes

source§

fn from_le_bytes(bytes: Self::LeBytes) -> Self

source§

impl HasUnsignedVersion for i128

§

type Unsigned = u128

§

type LeBytes = [u8; 16]

source§

fn to_le_bytes(self) -> Self::LeBytes

source§

fn from_le_bytes(bytes: Self::LeBytes) -> Self

source§

impl HasUnsignedVersion for isize

§

type Unsigned = usize

§

type LeBytes = [u8; 8]

source§

fn to_le_bytes(self) -> Self::LeBytes

source§

fn from_le_bytes(bytes: Self::LeBytes) -> Self

source§

impl HasUnsignedVersion for u8

§

type Unsigned = u8

§

type LeBytes = [u8; 1]

source§

fn to_le_bytes(self) -> Self::LeBytes

source§

fn from_le_bytes(bytes: Self::LeBytes) -> Self

source§

impl HasUnsignedVersion for u16

§

type Unsigned = u16

§

type LeBytes = [u8; 2]

source§

fn to_le_bytes(self) -> Self::LeBytes

source§

fn from_le_bytes(bytes: Self::LeBytes) -> Self

source§

impl HasUnsignedVersion for u32

§

type Unsigned = u32

§

type LeBytes = [u8; 4]

source§

fn to_le_bytes(self) -> Self::LeBytes

source§

fn from_le_bytes(bytes: Self::LeBytes) -> Self

source§

impl HasUnsignedVersion for u64

§

type Unsigned = u64

§

type LeBytes = [u8; 8]

source§

fn to_le_bytes(self) -> Self::LeBytes

source§

fn from_le_bytes(bytes: Self::LeBytes) -> Self

source§

impl HasUnsignedVersion for u128

§

type Unsigned = u128

§

type LeBytes = [u8; 16]

source§

fn to_le_bytes(self) -> Self::LeBytes

source§

fn from_le_bytes(bytes: Self::LeBytes) -> Self

source§

impl HasUnsignedVersion for usize

§

type Unsigned = usize

§

type LeBytes = [u8; 8]

source§

fn to_le_bytes(self) -> Self::LeBytes

source§

fn from_le_bytes(bytes: Self::LeBytes) -> Self

Implementors§