diff --git a/maplibre-demo/src/main.rs b/maplibre-demo/src/main.rs index 0d14fe5a..1156786d 100644 --- a/maplibre-demo/src/main.rs +++ b/maplibre-demo/src/main.rs @@ -1,7 +1,7 @@ use maplibre::error::Error; use maplibre::io::scheduler::ScheduleMethod; -use maplibre::io::source_client::HTTPClient; -use maplibre::map_schedule::MapSchedule; +use maplibre::io::source_client::{HttpClient, HttpSourceClient}; +use maplibre::map_schedule::{EventuallyMapContext, MapSchedule}; use maplibre::platform::http_client::ReqwestHttpClient; use maplibre::platform::run_multithreaded; use maplibre::platform::schedule_method::TokioScheduleMethod; diff --git a/maplibre-winit/src/winit/mod.rs b/maplibre-winit/src/winit/mod.rs index b3dbbf07..48313d0e 100644 --- a/maplibre-winit/src/winit/mod.rs +++ b/maplibre-winit/src/winit/mod.rs @@ -1,7 +1,7 @@ use instant::Instant; use maplibre::error::Error; use maplibre::io::scheduler::ScheduleMethod; -use maplibre::io::source_client::HTTPClient; +use maplibre::io::source_client::HttpClient; use std::borrow::BorrowMut; use winit::event::{ElementState, KeyboardInput, VirtualKeyCode, WindowEvent}; use winit::event_loop::ControlFlow; @@ -69,7 +69,7 @@ impl Runnable for WinitMapWindow where MWC: MapWindowConfig, SM: ScheduleMethod, - HC: HTTPClient, + HC: HttpClient, { fn run(mut self, mut map_state: MapSchedule, max_frames: Option) { let mut last_render_time = Instant::now(); diff --git a/maplibre/src/io/source_client.rs b/maplibre/src/io/source_client.rs index 44662bf9..6b094938 100644 --- a/maplibre/src/io/source_client.rs +++ b/maplibre/src/io/source_client.rs @@ -16,7 +16,7 @@ pub type HTTPClientFactory = dyn Fn() -> HC; /// the future "no-thread-safe-futures". Tokio futures are thread-safe. #[cfg_attr(feature = "no-thread-safe-futures", async_trait(?Send))] #[cfg_attr(not(feature = "no-thread-safe-futures"), async_trait)] -pub trait HTTPClient: Clone + Sync + Send + 'static { +pub trait HttpClient: Clone + Sync + Send + 'static { async fn fetch(&self, url: &str) -> Result, Error>; } @@ -25,7 +25,7 @@ pub trait HTTPClient: Clone + Sync + Send + 'static { #[derive(Clone)] pub struct HttpSourceClient where - HC: HTTPClient, + HC: HttpClient, { inner_client: HC, } @@ -35,7 +35,7 @@ where #[derive(Clone)] pub enum SourceClient where - HC: HTTPClient, + HC: HttpClient, { Http(HttpSourceClient), Mbtiles { @@ -45,7 +45,7 @@ where impl SourceClient where - HC: HTTPClient, + HC: HttpClient, { pub async fn fetch(&self, coords: &WorldTileCoords) -> Result, Error> { match self { @@ -57,7 +57,7 @@ where impl HttpSourceClient where - HC: HTTPClient, + HC: HttpClient, { pub fn new(http_client: HC) -> Self { Self { diff --git a/maplibre/src/lib.rs b/maplibre/src/lib.rs index 5a3349f4..060e1733 100644 --- a/maplibre/src/lib.rs +++ b/maplibre/src/lib.rs @@ -17,7 +17,7 @@ //! ``` use crate::io::scheduler::{ScheduleMethod, Scheduler}; -use crate::io::source_client::HTTPClient; +use crate::io::source_client::HttpClient; use crate::map_schedule::MapSchedule; use crate::render::settings::{RendererSettings, WgpuSettings}; use crate::render::{RenderState, Renderer}; @@ -96,7 +96,7 @@ pub struct UninitializedMap where MWC: MapWindowConfig, SM: ScheduleMethod, - HC: HTTPClient, + HC: HttpClient, { scheduler: Scheduler, http_client: HC, @@ -111,7 +111,7 @@ impl UninitializedMap where MWC: MapWindowConfig, SM: ScheduleMethod, - HC: HTTPClient, + HC: HttpClient, { /// Initializes the whole rendering pipeline for the given configuration. /// Returns the initialized map, ready to be run. diff --git a/maplibre/src/map_schedule.rs b/maplibre/src/map_schedule.rs index abeedb24..0abf6b26 100644 --- a/maplibre/src/map_schedule.rs +++ b/maplibre/src/map_schedule.rs @@ -5,7 +5,7 @@ use crate::error::Error; use crate::io::geometry_index::GeometryIndex; use crate::io::scheduler::Scheduler; use crate::io::shared_thread_state::SharedThreadState; -use crate::io::source_client::{HTTPClient, HttpSourceClient, SourceClient}; +use crate::io::source_client::{HttpClient, HttpSourceClient, SourceClient}; use crate::io::tile_cache::TileCache; use crate::io::tile_request_state::TileRequestState; use crate::io::TessellateMessage; @@ -80,7 +80,7 @@ pub struct MapSchedule where MWC: MapWindowConfig, SM: ScheduleMethod, - HC: HTTPClient, + HC: HttpClient, { map_window_config: MWC, @@ -98,7 +98,7 @@ impl MapSchedule where MWC: MapWindowConfig, SM: ScheduleMethod, - HC: HTTPClient, + HC: HttpClient, { pub fn new( map_window_config: MWC, diff --git a/maplibre/src/platform/noweb/http_client.rs b/maplibre/src/platform/noweb/http_client.rs index aa2d43c6..d6ba09b7 100644 --- a/maplibre/src/platform/noweb/http_client.rs +++ b/maplibre/src/platform/noweb/http_client.rs @@ -1,5 +1,5 @@ use crate::error::Error; -use crate::HTTPClient; +use crate::HttpClient; use async_trait::async_trait; use reqwest::{Client, StatusCode}; use reqwest_middleware::ClientWithMiddleware; @@ -41,7 +41,7 @@ impl ReqwestHttpClient { } #[async_trait] -impl HTTPClient for ReqwestHttpClient { +impl HttpClient for ReqwestHttpClient { async fn fetch(&self, url: &str) -> Result, Error> { let response = self.client.get(url).send().await?; match response.error_for_status() { diff --git a/maplibre/src/window.rs b/maplibre/src/window.rs index 784859e4..9e467d7a 100644 --- a/maplibre/src/window.rs +++ b/maplibre/src/window.rs @@ -1,6 +1,6 @@ //! Utilities for the window system. -use crate::{HTTPClient, MapSchedule, ScheduleMethod}; +use crate::{HttpClient, MapSchedule, ScheduleMethod}; use raw_window_handle::{HasRawWindowHandle, RawWindowHandle}; /// Window with a [carte::window::WindowSize]. @@ -25,7 +25,7 @@ pub trait Runnable where MWC: MapWindowConfig, SM: ScheduleMethod, - HC: HTTPClient, + HC: HttpClient, { fn run(self, map_state: MapSchedule, max_frames: Option); } diff --git a/web/src/platform/http_client.rs b/web/src/platform/http_client.rs index 39ea12ea..d503e8ee 100644 --- a/web/src/platform/http_client.rs +++ b/web/src/platform/http_client.rs @@ -1,5 +1,5 @@ use js_sys::{ArrayBuffer, Uint8Array}; -use maplibre::io::source_client::HTTPClient; +use maplibre::io::source_client::HttpClient; use wasm_bindgen::prelude::*; use wasm_bindgen::JsCast; use wasm_bindgen_futures::JsFuture; @@ -61,7 +61,7 @@ impl Clone for WHATWGFetchHttpClient { } #[async_trait(?Send)] -impl HTTPClient for WHATWGFetchHttpClient { +impl HttpClient for WHATWGFetchHttpClient { async fn fetch(&self, url: &str) -> Result, Error> { self.fetch_bytes(url) .await