mirror of
https://github.com/maplibre/maplibre-rs.git
synced 2025-12-08 19:05:57 +00:00
Fix compilation with http config
This commit is contained in:
parent
d6cff6be6e
commit
9bbf3deee7
@ -13,6 +13,14 @@ pub struct HttpFetcherConfig {
|
|||||||
pub cache_path: String,
|
pub cache_path: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for HttpFetcherConfig {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self {
|
||||||
|
cache_path: ".".to_string(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
|
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
|
||||||
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
|
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
|
||||||
pub trait HttpFetcher {
|
pub trait HttpFetcher {
|
||||||
|
|||||||
@ -49,13 +49,13 @@ impl TileFetcher for StaticTileFetcher {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::io::TileFetcher;
|
use crate::io::{HttpFetcherConfig, TileFetcher};
|
||||||
|
|
||||||
use super::StaticTileFetcher;
|
use super::StaticTileFetcher;
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_tiles_available() {
|
async fn test_tiles_available() {
|
||||||
let fetcher = StaticTileFetcher::new();
|
let fetcher = StaticTileFetcher::new(HttpFetcherConfig::default());
|
||||||
assert!(fetcher.fetch_tile(&(0, 0, 0).into()).await.is_err()); // World overview
|
assert!(fetcher.fetch_tile(&(0, 0, 0).into()).await.is_err()); // World overview
|
||||||
assert!(fetcher
|
assert!(fetcher
|
||||||
.fetch_tile(
|
.fetch_tile(
|
||||||
|
|||||||
@ -39,11 +39,11 @@ impl TileFetcher for WebTileFetcher {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::WebTileFetcher;
|
use super::WebTileFetcher;
|
||||||
use crate::io::TileFetcher;
|
use crate::io::{HttpFetcherConfig, TileFetcher};
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_tiles_available() {
|
async fn test_tiles_available() {
|
||||||
let fetcher = WebTileFetcher::new();
|
let fetcher = WebTileFetcher::new(HttpFetcherConfig::default());
|
||||||
assert!(fetcher.fetch_tile(&(0, 0, 0).into()).await.is_ok()); // World overview
|
assert!(fetcher.fetch_tile(&(0, 0, 0).into()).await.is_ok()); // World overview
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user