Trait Primitive

trait Primitive

A trait intended for simple fixed-length primitives (such as ints and floats) which allows them to be read and written to streams of different endiannesses verbatim.

Associated Types

type Bytes: TraitBound { trait_: Path { path: "AsRef", id: Id(536), args: Some(AngleBracketed { args: [Type(Slice(Primitive("u8")))], constraints: [] }) }, generic_params: [], modifier: None } + TraitBound { trait_: Path { path: "AsMut", id: Id(537), args: Some(AngleBracketed { args: [Type(Slice(Primitive("u8")))], constraints: [] }) }, generic_params: [], modifier: None }

The raw byte representation of this numeric type

Required Methods

fn buffer() -> <Self as >::Bytes

An empty buffer of this type's size

fn to_be_bytes(self: Self) -> <Self as >::Bytes

Our value in big-endian bytes

fn to_le_bytes(self: Self) -> <Self as >::Bytes

Our value in little-endian bytes

fn from_be_bytes(bytes: <Self as >::Bytes) -> Self

Convert big-endian bytes to our value

fn from_le_bytes(bytes: <Self as >::Bytes) -> Self

Convert little-endian bytes to our value

Implementors