Skip to content

Commit

Permalink
Use built-in async recursion
Browse files Browse the repository at this point in the history
  • Loading branch information
nyurik committed Apr 10, 2024
1 parent 2cb01c9 commit a82590f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0"
description = "Implementation of the PMTiles v3 spec with multiple sync and async backends."
repository = "https://github.com/stadiamaps/pmtiles-rs"
keywords = ["pmtiles", "gis", "geo"]
rust-version = "1.68.2"
rust-version = "1.77"
categories = ["science::geo"]

[features]
Expand All @@ -34,13 +34,12 @@ __async-s3-rustls = ["rust-s3?/tokio-rustls-tls"]
[dependencies]
# TODO: determine how we want to handle compression in async & sync environments
async-compression = { version = "0.4", features = ["gzip", "zstd", "brotli"] }
async-recursion = "1"
async-trait = "0.1"
bytes = "1"
fmmap = { version = "0.3", default-features = false, optional = true }
hilbert_2d = "1"
reqwest = { version = "0.12.3", default-features = false, optional = true }
rust-s3 = { version = "0.33.0", optional = true, default-features = false, features = ["fail-on-err"] }
rust-s3 = { version = "0.33.0", optional = true, default-features = false, features = ["fail-on-err"] }
serde = { version = "1", optional = true }
serde_json = { version = "1", optional = true }
thiserror = "1"
Expand Down
4 changes: 1 addition & 3 deletions src/async_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// so any file larger than 4GB, or an untrusted file with bad data may crash.
#![allow(clippy::cast_possible_truncation)]

use async_recursion::async_recursion;
use async_trait::async_trait;
use bytes::Bytes;
#[cfg(feature = "__async")]
Expand Down Expand Up @@ -148,7 +147,6 @@ impl<B: AsyncBackend + Sync + Send, C: DirectoryCache + Sync + Send> AsyncPmTile
Ok(entry.cloned())
}

#[async_recursion]
async fn find_entry_rec(
&self,
tile_id: u64,
Expand All @@ -175,7 +173,7 @@ impl<B: AsyncBackend + Sync + Send, C: DirectoryCache + Sync + Send> AsyncPmTile
if let Some(ref entry) = entry {
if entry.is_leaf() {
return if depth <= 4 {
self.find_entry_rec(tile_id, entry, depth + 1).await
Box::pin(self.find_entry_rec(tile_id, entry, depth + 1)).await
} else {
Ok(None)
};
Expand Down

0 comments on commit a82590f

Please sign in to comment.