ReadFlatBuffer

Trait ReadFlatBuffer 

Source
pub trait ReadFlatBuffer: Sized {
    type Source<'a>: Verifiable + Follow<'a>;
    type Error: From<InvalidFlatbuffer>;

    // Required method
    fn read_flatbuffer<'buf>(
        fb: &<Self::Source<'buf> as Follow<'buf>>::Inner,
    ) -> Result<Self, Self::Error>;

    // Provided method
    fn read_flatbuffer_bytes<'buf>(
        bytes: &'buf [u8],
    ) -> Result<Self, Self::Error>
       where <Self as ReadFlatBuffer>::Source<'buf>: 'buf { ... }
}
Expand description

Trait for reading a type from a FlatBuffer.

Required Associated Types§

Source

type Source<'a>: Verifiable + Follow<'a>

The FlatBuffer type that this type can be read from.

Source

type Error: From<InvalidFlatbuffer>

The error type returned when reading fails.

Required Methods§

Source

fn read_flatbuffer<'buf>( fb: &<Self::Source<'buf> as Follow<'buf>>::Inner, ) -> Result<Self, Self::Error>

Reads this type from a FlatBuffer source.

Provided Methods§

Source

fn read_flatbuffer_bytes<'buf>(bytes: &'buf [u8]) -> Result<Self, Self::Error>
where <Self as ReadFlatBuffer>::Source<'buf>: 'buf,

Reads this type from bytes representing a FlatBuffer source.

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§