Trait ReadUnion

Source
pub trait ReadUnion: Sized {
    type TupleReader<'parent>: ReadTuple
       where Self: 'parent;
    type StructReader<'parent>: ReadStruct
       where Self: 'parent;

    // Required methods
    fn read_tuple<'parent, 'me, T: StrictSum>(
        &'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: StrictSum>(
        &'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: StrictSum + From<I>, I: StrictDecode>(
        &mut self,
    ) -> Result<T, DecodeError> { ... }
}

Required Associated Types§

Source

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

Source

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

Required Methods§

Source

fn read_tuple<'parent, 'me, T: StrictSum>( &'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: StrictSum>( &'me mut self, inner: impl FnOnce(&mut Self::StructReader<'parent>) -> Result<T, DecodeError>, ) -> Result<T, DecodeError>
where Self: 'parent, 'me: 'parent,

Provided Methods§

Source

fn read_newtype<T: StrictSum + From<I>, I: StrictDecode>( &mut self, ) -> Result<T, DecodeError>

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> ReadUnion for StrictReader<R>

Source§

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

Source§

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