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§
Sourcefn open(source: FileSource) -> Result<Self, FormatError>where
Self: Sized,
fn open(source: FileSource) -> Result<Self, FormatError>where
Self: Sized,
ファイルを開き、ヘッダー/フッター/セクションインデックスを初期化する。
Sourcefn header(&self) -> &FileHeader
fn header(&self) -> &FileHeader
ヘッダーへの参照を返す。
フッターへの参照を返す。
Sourcefn section_index(&self) -> &SectionIndex
fn section_index(&self) -> &SectionIndex
セクションインデックスへの参照を返す。
Sourcefn read_section(&self, section_id: u32) -> Result<Vec<u8>, FormatError>
fn read_section(&self, section_id: u32) -> Result<Vec<u8>, FormatError>
指定セクションを解凍済みバイト列で読み取る。
Sourcefn read_section_raw(&self, section_id: u32) -> Result<Vec<u8>, FormatError>
fn read_section_raw(&self, section_id: u32) -> Result<Vec<u8>, FormatError>
指定セクションを圧縮状態のまま読み取る。
Sourcefn validate_section(&self, section_id: u32) -> Result<(), FormatError>
fn validate_section(&self, section_id: u32) -> Result<(), FormatError>
指定セクションのチェックサムを検証する(圧縮後データを対象)。
Sourcefn validate_all(&self) -> Result<(), FormatError>
fn validate_all(&self) -> Result<(), FormatError>
全セクションの整合性を検証する。
Sourcefn prefetch_sections<'a>(&'a self, section_ids: &'a [u32]) -> PrefetchFuture<'a>
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§
impl FileReader for AlopexFileReader
Available on non-WebAssembly only.