pub trait EndianScalar: Sized + PartialEq + Copy + Clone {
    type Scalar: TriviallyTransmutable;

    fn to_little_endian(self) -> Self::Scalar;
    fn from_little_endian(v: Self::Scalar) -> 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 Associated Types§

Required Methods§

Implementations on Foreign Types§

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

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

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

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

Implementors§