Trait TypedRead

Source
pub trait TypedRead {
    type TupleReader<'parent>: ReadTuple
       where Self: 'parent;
    type StructReader<'parent>: ReadStruct
       where Self: 'parent;
    type UnionReader: ReadUnion;
    type RawReader: ReadRaw;

    // Required methods
    fn read_union<T: StrictUnion>(
        &mut self,
        inner: impl FnOnce(VariantName, &mut Self::UnionReader) -> Result<T, DecodeError>,
    ) -> Result<T, DecodeError>;
    fn read_enum<T: StrictEnum>(&mut self) -> Result<T, DecodeError>
       where u8: From<T>;
    fn read_tuple<'parent, 'me, T: StrictTuple>(
        &'me mut self,
        inner: impl FnOnce(&mut Self::TupleReader<'parent>) -> Result<T, DecodeError>,
    ) -> Result<T, DecodeError>
       where Self: 'parent,
             'me: 'parent;
    fn read_struct<'parent, 'me, T: StrictStruct>(
        &'me mut self,
        inner: impl FnOnce(&mut Self::StructReader<'parent>) -> Result<T, DecodeError>,
    ) -> Result<T, DecodeError>
       where Self: 'parent,
             'me: 'parent;

    // Provided method
    fn read_newtype<T: StrictTuple + Wrapper>(
        &mut self,
    ) -> Result<T, DecodeError>
       where T::Inner: StrictDecode { ... }
}

Required Associated Types§

Source

type TupleReader<'parent>: ReadTuple where Self: 'parent

Source

type StructReader<'parent>: ReadStruct where Self: 'parent

Source

type UnionReader: ReadUnion

Source

type RawReader: ReadRaw

Required Methods§

Source

fn read_union<T: StrictUnion>( &mut self, inner: impl FnOnce(VariantName, &mut Self::UnionReader) -> Result<T, DecodeError>, ) -> Result<T, DecodeError>

Source

fn read_enum<T: StrictEnum>(&mut self) -> Result<T, DecodeError>
where u8: From<T>,

Source

fn read_tuple<'parent, 'me, T: StrictTuple>( &'me mut self, inner: impl FnOnce(&mut Self::TupleReader<'parent>) -> Result<T, DecodeError>, ) -> Result<T, DecodeError>
where Self: 'parent, 'me: 'parent,

Source

fn read_struct<'parent, 'me, T: StrictStruct>( &'me mut self, inner: impl FnOnce(&mut Self::StructReader<'parent>) -> Result<T, DecodeError>, ) -> Result<T, DecodeError>
where Self: 'parent, 'me: 'parent,

Provided Methods§

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<R: ReadRaw> TypedRead for StrictReader<R>

Source§

type TupleReader<'parent> = TupleReader<'parent, R> where Self: 'parent

Source§

type StructReader<'parent> = StructReader<'parent, R> where Self: 'parent

Source§

type UnionReader = StrictReader<R>

Source§

type RawReader = R