Trait flatbuffers::EndianScalar[][src]

pub trait EndianScalar: Sized + PartialEq + Copy + Clone {
    fn to_little_endian(self) -> Self;
fn from_little_endian(self) -> Self; }
Expand description

Trait for values that must be stored in little-endian byte order, but might be represented in memory as big-endian. Every type that implements EndianScalar is a valid FlatBuffers scalar value.

The Rust stdlib does not provide a trait to represent scalars, so this trait serves that purpose, too.

Note that we do not use the num-traits crate for this, because it provides “too much”. For example, num-traits provides i128 support, but that is an invalid FlatBuffers type.

Required methods

fn to_little_endian(self) -> Self[src]

fn from_little_endian(self) -> Self[src]

Implementations on Foreign Types

impl EndianScalar for bool[src]

fn to_little_endian(self) -> Self[src]

fn from_little_endian(self) -> Self[src]

impl EndianScalar for u8[src]

fn to_little_endian(self) -> Self[src]

fn from_little_endian(self) -> Self[src]

impl EndianScalar for i8[src]

fn to_little_endian(self) -> Self[src]

fn from_little_endian(self) -> Self[src]

impl EndianScalar for u16[src]

fn to_little_endian(self) -> Self[src]

fn from_little_endian(self) -> Self[src]

impl EndianScalar for u32[src]

fn to_little_endian(self) -> Self[src]

fn from_little_endian(self) -> Self[src]

impl EndianScalar for u64[src]

fn to_little_endian(self) -> Self[src]

fn from_little_endian(self) -> Self[src]

impl EndianScalar for i16[src]

fn to_little_endian(self) -> Self[src]

fn from_little_endian(self) -> Self[src]

impl EndianScalar for i32[src]

fn to_little_endian(self) -> Self[src]

fn from_little_endian(self) -> Self[src]

impl EndianScalar for i64[src]

fn to_little_endian(self) -> Self[src]

fn from_little_endian(self) -> Self[src]

impl EndianScalar for f32[src]

fn to_little_endian(self) -> Self[src]

Convert f32 from host endian-ness to little-endian.

fn from_little_endian(self) -> Self[src]

Convert f32 from little-endian to host endian-ness.

impl EndianScalar for f64[src]

fn to_little_endian(self) -> Self[src]

Convert f64 from host endian-ness to little-endian.

fn from_little_endian(self) -> Self[src]

Convert f64 from little-endian to host endian-ness.

Implementors