pub trait TileSource: Send + Sync {
// Required methods
fn request(&self, id: TileId);
fn poll(&self) -> Vec<(TileId, Result<TileResponse, TileError>)>;
// Provided methods
fn request_many(&self, ids: &[TileId]) { ... }
fn request_revalidate(&self, id: TileId, _hint: RevalidationHint) { ... }
fn request_revalidate_many(&self, ids: &[(TileId, RevalidationHint)]) { ... }
fn cancel(&self, _id: TileId) { ... }
fn cancel_many(&self, ids: &[TileId]) { ... }
fn diagnostics(&self) -> Option<TileSourceDiagnostics> { ... }
}Expand description
A tile source that can fetch tiles by ID.
The engine does not own an async runtime. The host provides completed results via polling or callbacks.
Required Methods§
Sourcefn request(&self, id: TileId)
fn request(&self, id: TileId)
Start fetching a tile. Returns immediately.
The implementation should arrange for the result to be
retrievable via TileSource::poll.
Provided Methods§
Sourcefn request_many(&self, ids: &[TileId])
fn request_many(&self, ids: &[TileId])
Start fetching multiple tiles.
The default implementation forwards to request
in-order, but implementations may override this to batch or
reprioritize work internally.
Sourcefn request_revalidate(&self, id: TileId, _hint: RevalidationHint)
fn request_revalidate(&self, id: TileId, _hint: RevalidationHint)
Start a conditional revalidation fetch for a stale tile.
Implementations that support conditional revalidation should
attach If-None-Match / If-Modified-Since headers derived
from hint so the server can respond with 304 Not Modified
when the tile has not changed.
The default implementation ignores the hint and falls back to a
normal request.
Sourcefn request_revalidate_many(&self, ids: &[(TileId, RevalidationHint)])
fn request_revalidate_many(&self, ids: &[(TileId, RevalidationHint)])
Start conditional revalidation for multiple tiles.
The default implementation forwards to
request_revalidate in-order.
Sourcefn cancel(&self, _id: TileId)
fn cancel(&self, _id: TileId)
Cancel a previously requested tile fetch.
Implementations may ignore this if cancellation is not supported. The default implementation does nothing.
Sourcefn cancel_many(&self, ids: &[TileId])
fn cancel_many(&self, ids: &[TileId])
Cancel multiple previously requested tile fetches.
The default implementation forwards to cancel
in-order.
Sourcefn diagnostics(&self) -> Option<TileSourceDiagnostics>
fn diagnostics(&self) -> Option<TileSourceDiagnostics>
Optional runtime diagnostics about the source fetch pipeline.