Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use built-in async recursion #35

Merged
merged 2 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[package]
name = "pmtiles"
version = "0.9.0"
version = "0.10.0"
edition = "2021"
authors = ["Luke Seelenbinder <[email protected]>"]
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.75.0"
rust-version = "1.77.0"
categories = ["science::geo"]

[features]
Expand All @@ -34,7 +34,6 @@ __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"
bytes = "1"
fmmap = { version = "0.3", default-features = false, optional = true }
hilbert_2d = "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 @@ -4,7 +4,6 @@

use std::future::Future;

use async_recursion::async_recursion;
use bytes::Bytes;
#[cfg(feature = "__async")]
use tokio::io::AsyncReadExt;
Expand Down Expand Up @@ -149,7 +148,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 @@ -176,7 +174,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