pub struct Reader<R> {
meta_data: MetaData,
remaining_reader: PeekRead<Tracking<R>>,
}
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
.
Fields§
§meta_data: MetaData
§remaining_reader: PeekRead<Tracking<R>>
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.
Trait Implementations§
Auto Trait Implementations§
impl<R> Freeze for Reader<R>where
R: Freeze,
impl<R> !RefUnwindSafe for Reader<R>
impl<R> Send for Reader<R>where
R: Send,
impl<R> Sync for Reader<R>where
R: Sync,
impl<R> Unpin for Reader<R>where
R: Unpin,
impl<R> !UnwindSafe for Reader<R>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more