Trait bpx::Interface[][src]

pub trait Interface {
    fn find_section_by_type(&self, btype: u8) -> Option<SectionHandle>;
fn find_all_sections_of_type(&self, btype: u8) -> Vec<SectionHandle>;
fn find_section_by_index(&self, index: u32) -> Option<SectionHandle>;
fn get_section_header(&self, handle: SectionHandle) -> &SectionHeader;
fn open_section(
        &mut self,
        handle: SectionHandle
    ) -> Result<&mut dyn SectionData>;
fn get_main_header(&self) -> &MainHeader; }
Expand description

The interface implemented by both the BPX encoder and decoder

Required methods

fn find_section_by_type(&self, btype: u8) -> Option<SectionHandle>[src]

Searches for the first section of a given type

Arguments

  • btype - section type byte

Returns

  • None if no section could be found
  • a handle to the section

fn find_all_sections_of_type(&self, btype: u8) -> Vec<SectionHandle>[src]

Searches for all sections of a given type

Arguments

  • btype - section type byte

Returns

  • a list of handles from all sections matching the given type

fn find_section_by_index(&self, index: u32) -> Option<SectionHandle>[src]

Locates a section by its index in the file

Arguments

  • index - the section index to search for

Returns

  • None if the section does not exist
  • a handle to the section

fn get_section_header(&self, handle: SectionHandle) -> &SectionHeader[src]

Gets the BPX section header

panics if the given section handle is invalid

Arguments

  • handle - a handle to the section

Returns

  • read-only reference to the BPX section header

fn open_section(
    &mut self,
    handle: SectionHandle
) -> Result<&mut dyn SectionData>
[src]

Opens a section for read and/or write

panics if the given section handle is invalid

Arguments

  • handle - a handle to the section

Returns

  • reference to the section data

fn get_main_header(&self) -> &MainHeader[src]

Gets the BPX main header

Returns

  • read-only reference to the BPX main header

Implementors

impl<'a, TBackend: IoBackend> Interface for Decoder<'a, TBackend>[src]

impl<'a, TBackend: IoBackend> Interface for Encoder<'a, TBackend>[src]