pub trait SectionReader {
    type Item;

    // Required methods
    fn read(&mut self) -> Result<Self::Item, BinaryReaderError>;
    fn eof(&self) -> bool;
    fn original_position(&self) -> usize;
    fn range(&self) -> Range<usize> ;

    // Provided method
    fn ensure_end(&self) -> Result<(), BinaryReaderError> { ... }
}
Expand description

A trait implemented by section readers.

Required Associated Types§

source

type Item

The item returned by the reader.

Required Methods§

source

fn read(&mut self) -> Result<Self::Item, BinaryReaderError>

Reads an item from the section.

source

fn eof(&self) -> bool

Determines if the reader is at end-of-section.

source

fn original_position(&self) -> usize

Gets the original position of the reader.

source

fn range(&self) -> Range<usize>

Gets the range of the reader.

Provided Methods§

source

fn ensure_end(&self) -> Result<(), BinaryReaderError>

Ensures the reader is at the end of the section.

This methods returns an error if there is more data in the section than what is described by the section’s header.

Implementors§

source§

impl<'a> SectionReader for AliasSectionReader<'a>

§

type Item = Alias<'a>

source§

impl<'a> SectionReader for CodeSectionReader<'a>

§

type Item = FunctionBody<'a>

source§

impl<'a> SectionReader for ComponentAliasSectionReader<'a>

source§

impl<'a> SectionReader for ComponentCanonicalSectionReader<'a>

source§

impl<'a> SectionReader for ComponentExportSectionReader<'a>

source§

impl<'a> SectionReader for ComponentImportSectionReader<'a>

source§

impl<'a> SectionReader for ComponentInstanceSectionReader<'a>

source§

impl<'a> SectionReader for ComponentStartSectionReader<'a>

source§

impl<'a> SectionReader for ComponentTypeSectionReader<'a>

source§

impl<'a> SectionReader for CoreTypeSectionReader<'a>

§

type Item = CoreType<'a>

source§

impl<'a> SectionReader for DataSectionReader<'a>

§

type Item = Data<'a>

source§

impl<'a> SectionReader for ElementSectionReader<'a>

§

type Item = Element<'a>

source§

impl<'a> SectionReader for ExportSectionReader<'a>

§

type Item = Export<'a>

source§

impl<'a> SectionReader for FunctionSectionReader<'a>

§

type Item = u32

source§

impl<'a> SectionReader for GlobalSectionReader<'a>

§

type Item = Global<'a>

source§

impl<'a> SectionReader for ImportSectionReader<'a>

§

type Item = Import<'a>

source§

impl<'a> SectionReader for InstanceSectionReader<'a>

§

type Item = Instance<'a>

source§

impl<'a> SectionReader for LinkingSectionReader<'a>

source§

impl<'a> SectionReader for MemorySectionReader<'a>

source§

impl<'a> SectionReader for NameSectionReader<'a>

§

type Item = Name<'a>

source§

impl<'a> SectionReader for ProducersSectionReader<'a>

source§

impl<'a> SectionReader for RelocSectionReader<'a>

§

type Item = Reloc

source§

impl<'a> SectionReader for TableSectionReader<'a>

source§

impl<'a> SectionReader for TagSectionReader<'a>

source§

impl<'a> SectionReader for TypeSectionReader<'a>

§

type Item = Type