Trait Parser

Source
pub trait Parser: Default {
    type Output;

    const ID_BYTES: [u8; 4];
    const MIN_SUPPORTED_VERSION: u32;

    // Required method
    fn read(
        &mut self,
        reader: &mut ReadSeek<impl Read + Seek>,
    ) -> Result<Self::Output>;
}
Expand description

Contains logic for parsing a specific file format.

Required Associated Constants§

Source

const ID_BYTES: [u8; 4]

The “magic number” bytes identifying the type of file.

Source

const MIN_SUPPORTED_VERSION: u32

The minimum version of the file format this parser supports.

Required Associated Types§

Source

type Output

The result of successfully parsing a file.

Required Methods§

Source

fn read( &mut self, reader: &mut ReadSeek<impl Read + Seek>, ) -> Result<Self::Output>

Attempts to parse a file with the given format’s semantics.

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§