Expand description
Resource loading: Resource, Response, the FileSource trait, the
Loader over the built-in file sources (assets, local files, MBTiles,
PMTiles, the cache database and the network), OfflineDatabase and the
offline region definitions. OfflineDownload is in offline.
The crate’s sqlite feature (on by default) holds everything that needs SQLite:
OfflineDatabase, the database file source and the MBTiles file source.
Without it a Loader has no cache (examples/web relies on the browser’s
HTTP cache instead).
Re-exports§
pub use resource::Kind;pub use resource::LoadingMethod;pub use resource::RequestOrder;pub use resource::Resource;pub use resource::StoragePolicy;pub use resource::TileFormat;pub use response::Data;pub use response::ResourceError;pub use response::Response;
Modules§
- chrono
- compression
- constants
- The storage’s defaults and URL protocols.
- http_
header_ transform - Headers a host adds to the HTTP requests of the online file source, as
maplibre-native-ffi’s HTTP file sources do for its
mln_runtime_set_http_header_transform. MapLibre Native has no counterpart. - network_
status - Whether the network is reachable, as the host reports it.
- offline
- resource
- resource_
transform - response
Structs§
- Database
File Source - The
Databasefile source: the ambient cache and the offline regions, in an SQLite database that a worker thread owns, with the worker’s extensionEbeside it. Its drop orshut_downwaits for the worker to end, unless it runs on the worker’s thread. When the worker’s thread can’t start, the source logs why, fails each request, and drops the work sent to it. - Loader
- The resource loader: one file source over the asset, file, MBTiles and PMTiles file sources, and the cache database and network, if it has them.
- Loader
Builder - Builds a
Loaderfrom the file sources it’s given. - Online
File Source - The
Networkfile source: HTTP(S) requests, revalidated when they expire and retried with a backoff after errors, with a bounded number of transfers in flight. Requests that would send the same transfer at once share it. Its requests follow theNetworkStatusit was made with. - Request
- A request for a resource. Dropping it cancels the request: the file source stops what work it can, and no response reaches the callback after the drop. The drop doesn’t wait for a call that began before it, on the responder’s thread, so a callback may drop its own request.
- Resource
Options - Where a
Loaderkeeps its cache and finds its assets. - Responder
- The file source’s side of a
Request: where it sends the responses, from any thread, and how it learns that the requester cancelled.
Traits§
- Cache
- A cache that a
Loaderreads before the network, and stores the network’s responses in. - File
Source - A source of resources. File sources are shared between threads, hence
Send + Sync. Each takes its configuration when it’s made, or through methods of its own type. - File
Source Ext - Requests through a
FileSource.
Type Aliases§
- Callback
- Receives a request’s responses, on the thread that sends each one.