Skip to main content

Module reader

Module reader 

Source
Expand description

Reading a tilepack: parse front matter from a prefix, then address tiles by byte range or by slice.

Structs§

FrontMatter
Parsed header, descriptors, layout, and offset index — everything needed to plan tile fetches without touching a single tile blob.
Prelude
Parsed header, descriptors, and layout — the prelude BEFORE the offset index. Everything a reader needs to plan lazy index lookups: hold these ~100 bytes, and any tile is locatable with one 16-byte read into the index region (Prelude::index_entry_span) plus one blob read.
SparseReader
A tilepack read lazily from a seekable source: only the Prelude is parsed up front, and each tile lookup reads its 16-byte index entry and then the blob — three bounded reads total, O(1) memory regardless of index size. The Read + Seek twin of the HTTP lazy-range pattern (and its executable specification: the oracle test holds it equal to TilepackReader).
TilepackReader
A tilepack read from a seekable source, fetching tile bytes on demand.
TilepackView
A tilepack held entirely in memory: address tiles as byte slices.

Functions§

required_len
The smallest prefix length that lets parsing advance past its current point, given the bytes in prefix. Grows monotonically across calls: HEADER_LEN, then the descriptor-table end, then the full front matter.