UsizeEncoding

Trait UsizeEncoding 

Source
pub trait UsizeEncoding: Sealed {
    // Required methods
    fn encode_usize<C, W>(
        cx: &mut C,
        writer: W,
        value: usize,
    ) -> Result<(), <C as Context>::Error>
       where C: Context<Input = <W as Writer>::Error>,
             W: Writer;
    fn decode_usize<'de, C, R>(
        cx: &mut C,
        reader: R,
    ) -> Result<usize, <C as Context>::Error>
       where C: Context<Input = <R as Reader<'de>>::Error>,
             R: Reader<'de>;
}
Expand description

Encoding formats which ensure that variably sized types (like usize, isize) are encoded in a format which is platform-neutral.

Required Methods§

Source

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

Governs how usize lengths are encoded into a Writer.

Source

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

Governs how usize lengths 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§