Expand description
Async retained data pipeline (worker-equivalent architecture.
This module provides the infrastructure for offloading heavy per-frame CPU work (terrain mesh generation, vector tessellation, symbol placement) to background tasks, matching the MapLibre/Mapbox web worker model.
§Architecture
The DataTaskPool trait is an executor-agnostic interface that the host
or renderer injects into MapState. The engine
submits work items via typed spawn methods and polls completed results
via DataTaskResultReceiver::try_recv each frame.
When no task pool is set, MapState falls back to synchronous inline
execution (current behavior), ensuring backward compatibility.
§Task families
| Family | Input | Output |
|---|---|---|
| Terrain | TerrainTaskInput (tile, elevation grid, config) | TerrainTaskOutput (mesh + hillshade) |
| Vector | VectorTaskInput (features, style, terrain samples, projection) | VectorTaskOutput (tessellated mesh + symbol candidates) |
§Retained model
Completed results are stored per cache key and reused across frames until invalidated by source data changes, camera origin movement, or zoom-level style property changes.
§Per-tile vector buckets (MapLibre parity)
Vector features can be spatially partitioned into per-tile buckets using
partition_features_by_tile. Each bucket is dispatched, tessellated,
and cached independently via VectorBucketKey, matching MapLibre’s
per-tile bucket architecture. Only buckets whose tiles are in the
visible set are collected for rendering; off-screen buckets are retained
in the cache for reuse when the camera pans back.
Structs§
- Async
Visualization Pipeline - Asynchronous preprocessing pipeline for large visualization data updates.
- MvtDecode
Output - Output from an async MVT decode task.
- Terrain
Cache Key - Cache key for a retained terrain task result.
- Terrain
Task Input - Input for an async terrain mesh generation task.
- Terrain
Task Output - Output from an async terrain mesh generation task.
- Thread
Data Task Pool - A simple
std::thread-basedDataTaskPoolimplementation. - Vector
Bucket Key - Cache key for a per-tile vector bucket.
- Vector
Cache Key - Cache key for a retained vector task result.
- Vector
Task Input - Input for an async vector tessellation task.
- Vector
Task Output - Output from an async vector tessellation task.
Enums§
- Visualization
Task Output - Output of an asynchronous visualization preprocessing task.
Traits§
- Data
Task Pool - An executor-agnostic task pool for offloading heavy data pipeline work.
- Data
Task Result Receiver - A result receiver for completed async data tasks.
Functions§
- partition_
features_ by_ tile - Partition a feature collection into per-tile sub-collections.