Skip to main content

ReadOption

Trait ReadOption 

Source
pub trait ReadOption<Ctx> {
    // Required method
    fn read_option_with<T, E, F>(&mut self, f: F) -> Result<Option<T>, E>
       where E: From<Error>,
             F: FnMut(&mut Reader<'_, Ctx>) -> Result<T, E>;

    // Provided method
    fn read_option<T>(&mut self) -> Result<Option<T>, T::Error>
       where T: Decode<Ctx> { ... }
}
Expand description

A trait for types that can be read from a Reader as an Option.

Required Methods§

Source

fn read_option_with<T, E, F>(&mut self, f: F) -> Result<Option<T>, E>
where E: From<Error>, F: FnMut(&mut Reader<'_, Ctx>) -> Result<T, E>,

Reads an Option from the reader using the provided function to read the inner value.

Provided Methods§

Source

fn read_option<T>(&mut self) -> Result<Option<T>, T::Error>
where T: Decode<Ctx>,

Reads an Option from the reader using the Decode trait to read the inner value.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<'a, Ctx> ReadOption<Ctx> for Reader<'a, Ctx>