pub struct Reader<R> { /* private fields */ }
Expand description
Decode the meta data from a byte source, keeping the source ready for further reading.
Continue decoding the remaining bytes by calling filtered_chunks
or all_chunks
.
Implementations§
source§impl<R: Read + Seek> Reader<R>
impl<R: Read + Seek> Reader<R>
sourcepub fn read_from_buffered(read: R, pedantic: bool) -> Result<Self>
pub fn read_from_buffered(read: R, pedantic: bool) -> Result<Self>
Start the reading process.
Immediately decodes the meta data into an internal field.
Access it viameta_data()
.
sourcepub fn into_meta_data(self) -> MetaData
pub fn into_meta_data(self) -> MetaData
Obtain the meta data ownership.
sourcepub fn all_chunks(self, pedantic: bool) -> Result<AllChunksReader<R>>
pub fn all_chunks(self, pedantic: bool) -> Result<AllChunksReader<R>>
Prepare to read all the chunks from the file. Does not decode the chunks now, but returns a decoder. Reading all chunks reduces seeking the file, but some chunks might be read without being used.
sourcepub fn filter_chunks(
self,
pedantic: bool,
filter: impl FnMut(&MetaData, TileCoordinates, BlockIndex) -> bool
) -> Result<FilteredChunksReader<R>>
pub fn filter_chunks( self, pedantic: bool, filter: impl FnMut(&MetaData, TileCoordinates, BlockIndex) -> bool ) -> Result<FilteredChunksReader<R>>
Prepare to read some the chunks from the file. Does not decode the chunks now, but returns a decoder. Reading only some chunks may seeking the file, potentially skipping many bytes.