Skip to main content

Integer

Trait Integer 

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

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Integer for i8

Source§

type Encoded = [u8; 1]

Source§

fn to_be_bytes(self) -> Self::Encoded

Source§

impl Integer for i16

Source§

type Encoded = [u8; 2]

Source§

fn to_be_bytes(self) -> Self::Encoded

Source§

impl Integer for i32

Source§

type Encoded = [u8; 4]

Source§

fn to_be_bytes(self) -> Self::Encoded

Source§

impl Integer for i64

Source§

type Encoded = [u8; 8]

Source§

fn to_be_bytes(self) -> Self::Encoded

Source§

impl Integer for i128

Source§

type Encoded = [u8; 16]

Source§

fn to_be_bytes(self) -> Self::Encoded

Source§

impl Integer for u8

Source§

type Encoded = [u8; 1]

Source§

fn to_be_bytes(self) -> Self::Encoded

Source§

impl Integer for u16

Source§

type Encoded = [u8; 2]

Source§

fn to_be_bytes(self) -> Self::Encoded

Source§

impl Integer for u32

Source§

type Encoded = [u8; 4]

Source§

fn to_be_bytes(self) -> Self::Encoded

Source§

impl Integer for u64

Source§

type Encoded = [u8; 8]

Source§

fn to_be_bytes(self) -> Self::Encoded

Source§

impl Integer for u128

Source§

type Encoded = [u8; 16]

Source§

fn to_be_bytes(self) -> Self::Encoded

Implementors§