Skip to main content

FileReader

Trait FileReader 

Source
pub trait FileReader {
    // Required methods
    fn open(source: FileSource) -> Result<Self, FormatError>
       where Self: Sized;
    fn header(&self) -> &FileHeader;
    fn footer(&self) -> &FileFooter;
    fn section_index(&self) -> &SectionIndex;
    fn read_section(&self, section_id: u32) -> Result<Vec<u8>, FormatError>;
    fn read_section_raw(&self, section_id: u32) -> Result<Vec<u8>, FormatError>;
    fn validate_section(&self, section_id: u32) -> Result<(), FormatError>;
    fn validate_all(&self) -> Result<(), FormatError>;
    fn prefetch_sections<'a>(
        &'a self,
        section_ids: &'a [u32],
    ) -> PrefetchFuture<'a>;
}
Expand description

プラットフォーム共通のファイルリーダートレイト。

Required Methods§

Source

fn open(source: FileSource) -> Result<Self, FormatError>
where Self: Sized,

ファイルを開き、ヘッダー/フッター/セクションインデックスを初期化する。

Source

fn header(&self) -> &FileHeader

ヘッダーへの参照を返す。

Source

fn footer(&self) -> &FileFooter

フッターへの参照を返す。

Source

fn section_index(&self) -> &SectionIndex

セクションインデックスへの参照を返す。

Source

fn read_section(&self, section_id: u32) -> Result<Vec<u8>, FormatError>

指定セクションを解凍済みバイト列で読み取る。

Source

fn read_section_raw(&self, section_id: u32) -> Result<Vec<u8>, FormatError>

指定セクションを圧縮状態のまま読み取る。

Source

fn validate_section(&self, section_id: u32) -> Result<(), FormatError>

指定セクションのチェックサムを検証する(圧縮後データを対象)。

Source

fn validate_all(&self) -> Result<(), FormatError>

全セクションの整合性を検証する。

Source

fn prefetch_sections<'a>(&'a self, section_ids: &'a [u32]) -> PrefetchFuture<'a>

指定セクションを事前読み込みする(WASMではIndexedDBからの範囲読み込みを想定)。

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl FileReader for AlopexFileReader

Available on non-WebAssembly only.