mirror of
https://github.com/maplibre/maplibre-rs.git
synced 2025-12-08 19:05:57 +00:00
Fix tracy dependency versions
This commit is contained in:
parent
c7f7408a10
commit
3f1e165cda
@ -10,7 +10,7 @@ readme = "../README.md"
|
||||
|
||||
[features]
|
||||
web-webgl = ["maplibre/web-webgl"]
|
||||
trace = ["maplibre/trace", "tracing-subscriber", "tracing-tracy", "tracy-client"]
|
||||
trace = ["maplibre/trace"]
|
||||
|
||||
[dependencies]
|
||||
env_logger = "0.9.0"
|
||||
@ -19,9 +19,4 @@ maplibre-winit = { path = "../maplibre-winit", version = "0.0.1" }
|
||||
|
||||
tile-grid = "0.3"
|
||||
|
||||
tracing = "0.1.35"
|
||||
tracing-subscriber = { version = "0.3.14", optional = true }
|
||||
tracing-tracy = { version = "0.8", optional = true }
|
||||
tracy-client = { version = "0.12.7", optional = true }
|
||||
|
||||
clap = { version = "3.2.12", features = ["derive"] }
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
use maplibre::environment::DefaultTransferables;
|
||||
|
||||
use maplibre::platform::apc::SchedulerAsyncProcedureCall;
|
||||
use maplibre::io::apc::SchedulerAsyncProcedureCall;
|
||||
use maplibre::{
|
||||
platform::{http_client::ReqwestHttpClient, scheduler::TokioScheduler},
|
||||
MapBuilder,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
use maplibre::headless::HeadlessEnvironment;
|
||||
use maplibre::platform::apc::SchedulerAsyncProcedureCall;
|
||||
use maplibre::io::apc::SchedulerAsyncProcedureCall;
|
||||
use maplibre::{
|
||||
coords::{LatLon, WorldTileCoords},
|
||||
error::Error,
|
||||
|
||||
@ -8,15 +8,6 @@ use crate::{headed::run_headed, headless::run_headless};
|
||||
mod headed;
|
||||
mod headless;
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
fn enable_tracing() {
|
||||
use tracing_subscriber::{layer::SubscriberExt, Registry};
|
||||
|
||||
let subscriber = Registry::default().with(tracing_tracy::TracyLayer::new());
|
||||
|
||||
tracing::subscriber::set_global_default(subscriber).expect("setting default subscriber failed");
|
||||
}
|
||||
|
||||
#[derive(Parser)]
|
||||
#[clap(author, version, about, long_about = None)]
|
||||
#[clap(propagate_version = true)]
|
||||
@ -63,7 +54,7 @@ fn main() {
|
||||
env_logger::init_from_env(env_logger::Env::default().default_filter_or("info"));
|
||||
|
||||
#[cfg(feature = "trace")]
|
||||
enable_tracing();
|
||||
maplibre::platform::trace::enable_tracing();
|
||||
|
||||
let cli = Cli::parse();
|
||||
|
||||
|
||||
@ -14,8 +14,8 @@ use wgpu::{BufferAsyncError, BufferSlice};
|
||||
|
||||
use crate::environment::DefaultTransferables;
|
||||
use crate::io::apc::AsyncProcedureCall;
|
||||
use crate::io::apc::SchedulerAsyncProcedureCall;
|
||||
use crate::io::transferables::Transferables;
|
||||
use crate::platform::apc::SchedulerAsyncProcedureCall;
|
||||
use crate::{
|
||||
context::{MapContext, ViewState},
|
||||
coords::{LatLon, ViewRegion, WorldCoords, WorldTileCoords, Zoom, TILE_SIZE},
|
||||
|
||||
@ -27,13 +27,18 @@ pub enum Input {
|
||||
TileRequest(TileRequest),
|
||||
}
|
||||
|
||||
pub trait Context<T: Transferables, HC: HttpClient>: 'static {
|
||||
pub trait Context<T: Transferables, HC: HttpClient>: Send + 'static {
|
||||
fn send(&self, data: Message<T>);
|
||||
|
||||
fn source_client(&self) -> &SourceClient<HC>;
|
||||
}
|
||||
|
||||
pub type AsyncProcedure<C> = fn(input: Input, context: C) -> Pin<Box<dyn Future<Output = ()>>>;
|
||||
#[cfg(not(feature = "no-thread-safe-futures"))]
|
||||
pub type AsyncProcedureFuture = Pin<Box<(dyn Future<Output = ()> + Send + 'static)>>;
|
||||
#[cfg(feature = "no-thread-safe-futures")]
|
||||
pub type AsyncProcedureFuture = Pin<Box<(dyn Future<Output = ()> + 'static)>>;
|
||||
|
||||
pub type AsyncProcedure<C> = fn(input: Input, context: C) -> AsyncProcedureFuture;
|
||||
|
||||
pub trait AsyncProcedureCall<T: Transferables, HC: HttpClient>: 'static {
|
||||
type Context: Context<T, HC> + Send;
|
||||
|
||||
@ -41,10 +41,9 @@ pub mod scheduler {
|
||||
pub use super::noweb::scheduler::*;
|
||||
}
|
||||
|
||||
/// APC for non-web targets.
|
||||
pub mod apc {
|
||||
pub mod trace {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub use super::noweb::apc::*;
|
||||
pub use super::noweb::trace::*;
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
|
||||
@ -4,6 +4,7 @@ use std::future::Future;
|
||||
|
||||
pub mod http_client;
|
||||
pub mod scheduler;
|
||||
pub mod trace;
|
||||
|
||||
pub fn run_multithreaded<F: Future>(future: F) -> F::Output {
|
||||
tokio::runtime::Builder::new_multi_thread()
|
||||
|
||||
8
maplibre/src/platform/noweb/trace.rs
Normal file
8
maplibre/src/platform/noweb/trace.rs
Normal file
@ -0,0 +1,8 @@
|
||||
#[cfg(feature = "trace")]
|
||||
pub fn enable_tracing() {
|
||||
use tracing_subscriber::{layer::SubscriberExt, Registry};
|
||||
|
||||
let subscriber = Registry::default().with(tracing_tracy::TracyLayer::new());
|
||||
|
||||
tracing::subscriber::set_global_default(subscriber).expect("setting default subscriber failed");
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
//! Requests tiles which are currently in view
|
||||
|
||||
use crate::coords::ZoomLevel;
|
||||
use crate::io::apc::{AsyncProcedureCall, Context, Input};
|
||||
use crate::io::apc::{AsyncProcedureCall, AsyncProcedureFuture, Context, Input};
|
||||
use crate::io::pipeline::PipelineContext;
|
||||
use crate::io::pipeline::Processable;
|
||||
use crate::io::tile_pipelines::build_vector_tile_pipeline;
|
||||
@ -72,7 +72,7 @@ impl<E: Environment> Stage for RequestStage<E> {
|
||||
pub fn schedule<E: Environment, C: Context<E::Transferables, E::HttpClient>>(
|
||||
input: Input,
|
||||
context: C,
|
||||
) -> Pin<Box<(dyn Future<Output = ()> + 'static)>> {
|
||||
) -> AsyncProcedureFuture {
|
||||
// FIXME: improve input handling
|
||||
let input = match input {
|
||||
Input::TileRequest(input) => Some(input),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user