pub trait BinRead: Sized {
type Args: Any + Copy;
// Required method
fn read_options<R>(
reader: &mut R,
options: &ReadOptions,
args: Self::Args,
) -> Result<Self, Error>
where R: Read + Seek;
// Provided methods
fn read<R>(reader: &mut R) -> Result<Self, Error>
where R: Read + Seek { ... }
fn read_args<R>(reader: &mut R, args: Self::Args) -> Result<Self, Error>
where R: Read + Seek { ... }
fn after_parse<R>(
&mut self,
_: &mut R,
_: &ReadOptions,
_: Self::Args,
) -> Result<(), Error>
where R: Read + Seek { ... }
fn args_default() -> Option<Self::Args> { ... }
}Expand description
Required Associated Types§
Required Methods§
sourcefn read_options<R>(
reader: &mut R,
options: &ReadOptions,
args: Self::Args,
) -> Result<Self, Error>
fn read_options<R>( reader: &mut R, options: &ReadOptions, args: Self::Args, ) -> Result<Self, Error>
Read the type from the reader
Provided Methods§
sourcefn read<R>(reader: &mut R) -> Result<Self, Error>
fn read<R>(reader: &mut R) -> Result<Self, Error>
Read the type from the reader while assuming no arguments have been passed
§Panics
Panics if there is no args_default implementation
sourcefn read_args<R>(reader: &mut R, args: Self::Args) -> Result<Self, Error>
fn read_args<R>(reader: &mut R, args: Self::Args) -> Result<Self, Error>
Read the type from the reader using the specified arguments
fn after_parse<R>( &mut self, _: &mut R, _: &ReadOptions, _: Self::Args, ) -> Result<(), Error>
sourcefn args_default() -> Option<Self::Args>
fn args_default() -> Option<Self::Args>
The default arguments to be used when using the read shortcut method.
Override this for any type that optionally requries arguments
Object Safety§
This trait is not object safe.