Trait TopDecodeInput

Source
pub trait TopDecodeInput: Sized {
    type NestedBuffer: NestedDecodeInput;

    // Required methods
    fn byte_len(&self) -> usize;
    fn into_boxed_slice_u8(self) -> Box<[u8]>;
    fn into_nested_buffer(self) -> Self::NestedBuffer;

    // Provided methods
    fn into_u64(self) -> u64 { ... }
    fn into_i64(self) -> i64 { ... }
    fn into_specialized<T, F>(self, else_deser: F) -> Result<T, DecodeError>
       where T: TryStaticCast,
             F: FnOnce(Self) -> Result<T, DecodeError> { ... }
    fn into_specialized_or_exit<T, F, ExitCtx>(
        self,
        c: ExitCtx,
        exit: fn(ExitCtx, DecodeError) -> !,
        else_deser: F,
    ) -> T
       where T: TryStaticCast,
             ExitCtx: Clone,
             F: FnOnce(Self, ExitCtx, fn(ExitCtx, DecodeError) -> !) -> T { ... }
}
Expand description

Trait that abstracts away an underlying API for a top-level object deserializer. The underlying API can provide pre-parsed i64/u64 or pre-bundled boxed slices.

Required Associated Types§

Required Methods§

Source

fn byte_len(&self) -> usize

Length of the underlying data, in bytes.

Source

fn into_boxed_slice_u8(self) -> Box<[u8]>

Provides the underlying data as an owned byte slice box. Consumes the input object in the process.

Source

fn into_nested_buffer(self) -> Self::NestedBuffer

Provided Methods§

Source

fn into_u64(self) -> u64

Retrieves the underlying data as a pre-parsed u64. Expected to panic if the conversion is not possible.

Consumes the input object in the process.

Source

fn into_i64(self) -> i64

Retrieves the underlying data as a pre-parsed i64. Expected to panic if the conversion is not possible.

Consumes the input object in the process.

Source

fn into_specialized<T, F>(self, else_deser: F) -> Result<T, DecodeError>
where T: TryStaticCast, F: FnOnce(Self) -> Result<T, DecodeError>,

Source

fn into_specialized_or_exit<T, F, ExitCtx>( self, c: ExitCtx, exit: fn(ExitCtx, DecodeError) -> !, else_deser: F, ) -> T
where T: TryStaticCast, ExitCtx: Clone, F: FnOnce(Self, ExitCtx, fn(ExitCtx, DecodeError) -> !) -> T,

Note: currently not in use.

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.

Implementations on Foreign Types§

Source§

impl TopDecodeInput for Box<[u8]>

Source§

impl<'a> TopDecodeInput for &'a [u8]

Implementors§