pub trait BasicEncode {
    fn endianness(&self) -> Endianness;
    fn encode_us<W>(&self, to: W, value: u16) -> Result<()>
    where
        W: Write
; fn encode_ul<W>(&self, to: W, value: u32) -> Result<()>
    where
        W: Write
; fn encode_uv<W>(&self, to: W, value: u64) -> Result<()>
    where
        W: Write
; fn encode_ss<W>(&self, to: W, value: i16) -> Result<()>
    where
        W: Write
; fn encode_sl<W>(&self, to: W, value: i32) -> Result<()>
    where
        W: Write
; fn encode_sv<W>(&self, to: W, value: i64) -> Result<()>
    where
        W: Write
; fn encode_fl<W>(&self, to: W, value: f32) -> Result<()>
    where
        W: Write
; fn encode_fd<W>(&self, to: W, value: f64) -> Result<()>
    where
        W: Write
; fn with_encoder<T, F1, F2>(&self, f_le: F1, f_be: F2) -> T
    where
        F1: FnOnce(LittleEndianBasicEncoder) -> T,
        F2: FnOnce(BigEndianBasicEncoder) -> T
, { ... } fn encode_primitive<W>(&self, to: W, value: &PrimitiveValue) -> Result<usize>
    where
        W: Write
, { ... } }
Expand description

Type trait for an encoder of basic data properties. Unlike Encode (and similar to BasicDecode), this trait is not object safe because it’s better to just provide a dynamic implementation.

Required Methods

Retrieve the encoder’s endianness.

Encode an unsigned short value to the given writer.

Encode an unsigned long value to the given writer.

Encode an unsigned very long value to the given writer.

Encode a signed short value to the given writer.

Encode a signed long value to the given writer.

Encode a signed very long value to the given writer.

Encode a single precision float value to the given writer.

Encode a double precision float value to the given writer.

Provided Methods

If this encoder is in Little Endian, evaluate the first function. Otherwise, evaluate the second one.

Encode a primitive value to the given writer. The default implementation delegates to the other value encoding methods.

Implementors