Fix compilation with http config

This commit is contained in:
Maximilian Ammann 2022-01-17 10:32:04 +01:00
parent d6cff6be6e
commit 9bbf3deee7
3 changed files with 12 additions and 4 deletions

View File

@ -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 {

View File

@ -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(

View File

@ -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
} }
} }