pub trait Integer {
    type Encoded: AsRef<[u8]>;

    // Required method
    fn to_be_bytes(self) -> Self::Encoded;
}
Expand description

A trait representing an integer that can be encoded into big-endian bytes.

Required Associated Types§

source

type Encoded: AsRef<[u8]>

Type of the encoded representation.

Required Methods§

source

fn to_be_bytes(self) -> Self::Encoded

Return the memory representation of this integer as a byte array in big-endian byte order.

Implementations on Foreign Types§

source§

impl Integer for i8

§

type Encoded = [u8; 1]

source§

fn to_be_bytes(self) -> Self::Encoded

source§

impl Integer for i16

§

type Encoded = [u8; 2]

source§

fn to_be_bytes(self) -> Self::Encoded

source§

impl Integer for i32

§

type Encoded = [u8; 4]

source§

fn to_be_bytes(self) -> Self::Encoded

source§

impl Integer for i64

§

type Encoded = [u8; 8]

source§

fn to_be_bytes(self) -> Self::Encoded

source§

impl Integer for i128

§

type Encoded = [u8; 16]

source§

fn to_be_bytes(self) -> Self::Encoded

source§

impl Integer for u8

§

type Encoded = [u8; 1]

source§

fn to_be_bytes(self) -> Self::Encoded

source§

impl Integer for u16

§

type Encoded = [u8; 2]

source§

fn to_be_bytes(self) -> Self::Encoded

source§

impl Integer for u32

§

type Encoded = [u8; 4]

source§

fn to_be_bytes(self) -> Self::Encoded

source§

impl Integer for u64

§

type Encoded = [u8; 8]

source§

fn to_be_bytes(self) -> Self::Encoded

source§

impl Integer for u128

§

type Encoded = [u8; 16]

source§

fn to_be_bytes(self) -> Self::Encoded

Implementors§