mln-rs-engine 0.0.18

Part of mln-rs, a Rust port of the MapLibre Native map rendering core. Depend on mln-rs instead.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::sync::Arc;

use crate::storage::resource::Kind;
use crate::storage::response::ResourceError;

/// What a resource transform answers: the URL to load instead, or the error
/// to fail the request with. A failed request is never sent. When the
/// error's reason allows a retry, the retry calls the transform again.
pub type TransformResult = Result<String, ResourceError>;

/// The callback a resource transform answers through, once.
pub type FinishedCallback = Box<dyn FnOnce(TransformResult) + Send>;

/// Rewrites request URLs (asynchronously) before the online file source
/// requests them, or fails the requests. It gets the resource's kind and
/// URL, and runs on the online file source's thread, hence `Send + Sync`.
pub type ResourceTransform = Arc<dyn Fn(Kind, &str, FinishedCallback) + Send + Sync>;