Expand description
TileCache — abstract local storage for tiles.
Every “fetching” tile source ([crate::sources::OsmTileSource] is
the only one shipped today) writes through a TileCache rather
than dealing with the filesystem / SQLite / whatever directly.
That keeps the storage backend swappable: an embedded app can
ship FileTileCache writing under the OS cache dir; a desktop
app might prefer a single-file format (MBTiles, PMTiles); a test
can use a Vec in memory.
FileTileCache is the one concrete implementation right now and
is what backs the bundled sample-tiles/ directory.
Structs§
- File
Tile Cache - Stores tiles in a slippy-map directory tree on disk
(
{root}/{z}/{x}/{y}.{ext}). Compatible with every common tile bundle layout (the OSM standard, MapTiler exports, Mapbox tile downloads). The bundledsample-tiles/is one of these. - Layered
Tile Cache - Read-through composite cache.
get/containstry each layer in order until one hits;putonly writes to the first layer (which must be writable). Use to overlay a writable user cache over a read-only bundled cache: the bundled tiles serve instantly, new fetches accumulate in the user cache without polluting the bundle.
Enums§
- Cache
Error - Error returned by
TileCache::put.
Traits§
- Tile
Cache - Local storage for downloaded tiles. Implementations decide whether
the backing is a slippy-map directory tree, an MBTiles SQLite db,
a single PMTiles archive, or an in-memory
HashMapfor tests.