IntegerEncoding

Trait IntegerEncoding 

Source
pub trait IntegerEncoding:
    Clone
    + Copy
    + Debug
    + Eq
    + Hash
    + Ord
    + PartialEq
    + PartialOrd
    + Sealed {
    // Required methods
    fn encode_unsigned<C, W, T>(
        cx: &mut C,
        writer: W,
        value: T,
    ) -> Result<(), <C as Context>::Error>
       where C: Context<Input = <W as Writer>::Error>,
             W: Writer,
             T: ByteOrderIo;
    fn decode_unsigned<'de, C, R, T>(
        cx: &mut C,
        reader: R,
    ) -> Result<T, <C as Context>::Error>
       where C: Context<Input = <R as Reader<'de>>::Error>,
             R: Reader<'de>,
             T: ByteOrderIo;
    fn encode_signed<C, W, T>(
        cx: &mut C,
        writer: W,
        value: T,
    ) -> Result<(), <C as Context>::Error>
       where C: Context<Input = <W as Writer>::Error>,
             W: Writer,
             T: Signed,
             <T as Signed>::Unsigned: ByteOrderIo;
    fn decode_signed<'de, C, R, T>(
        cx: &mut C,
        reader: R,
    ) -> Result<T, <C as Context>::Error>
       where C: Context<Input = <R as Reader<'de>>::Error>,
             R: Reader<'de>,
             T: Signed,
             <T as Signed>::Unsigned: ByteOrderIo<Signed = T>;
}
Expand description

Trait which governs how integers are encoded in a binary format.

The two common implementations of this is Variable and Fixed.

Required Methods§

Source

fn encode_unsigned<C, W, T>( cx: &mut C, writer: W, value: T, ) -> Result<(), <C as Context>::Error>
where C: Context<Input = <W as Writer>::Error>, W: Writer, T: ByteOrderIo,

Governs how unsigned integers are encoded into a Writer.

Source

fn decode_unsigned<'de, C, R, T>( cx: &mut C, reader: R, ) -> Result<T, <C as Context>::Error>
where C: Context<Input = <R as Reader<'de>>::Error>, R: Reader<'de>, T: ByteOrderIo,

Governs how unsigned integers are decoded from a Reader.

Source

fn encode_signed<C, W, T>( cx: &mut C, writer: W, value: T, ) -> Result<(), <C as Context>::Error>
where C: Context<Input = <W as Writer>::Error>, W: Writer, T: Signed, <T as Signed>::Unsigned: ByteOrderIo,

Governs how signed integers are encoded into a Writer.

Source

fn decode_signed<'de, C, R, T>( cx: &mut C, reader: R, ) -> Result<T, <C as Context>::Error>
where C: Context<Input = <R as Reader<'de>>::Error>, R: Reader<'de>, T: Signed, <T as Signed>::Unsigned: ByteOrderIo<Signed = T>,

Governs how signed integers are decoded from a Reader.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl IntegerEncoding for Variable

IntegerEncoding and UsizeEncoding implementation which encodes integers using zigzag variable length encoding.

Source§

impl<B> IntegerEncoding for Fixed<B>
where B: ByteOrder,