# The PMTiles v3, MVT 2.1 and `.mamaps` codecs, shared by the offline tiler and the app. # # Extracted from `scripts/maps/tile_build`, which is still its older consumer. # The Android vector renderer in `:library:map` needs to read exactly the archives # that crate writes, and a second implementation of either format would be a # second thing to keep in agreement with the published basemap. So there is one. # # Member of the repo-root workspace (single root Cargo.lock). It is consumed by a # host binary AND by an aarch64-linux-android cdylib; workspace membership only # unifies version resolution and does not change its targets. # # `miniz_oxide` is the only dependency and is pure Rust, so this builds for the # host and cross-compiles for Android with no C toolchain and nothing to configure. # PMTiles gzips both its directories and its tiles, so the DEFLATE side is needed # as well as INFLATE. # # That single-pure-Rust-dependency rule is also what settled `.mamaps` compression. # The obvious choice on paper is zstd, but its encoder is C, so adding it would end # the property this whole file exists to preserve. `.mamaps` bodies are therefore raw # DEFLATE through the same `miniz_oxide`, and the format's `compression` header byte # keeps a swap open if a pure-Rust zstd encoder ever becomes worth the dependency. [package] name = "tilecodec" version = "0.1.0" edition = "2021" publish = false license = "GPL-2.0-only" description = "PMTiles v3, Mapbox Vector Tile 2.1 and .mamaps codecs shared by the Maps tiler and the Android renderer" [features] # The `.mamaps` writer. Off by default: Android reads archives and never writes one, # so gating it keeps the interner out of the cdylib and, more usefully, makes it a # compile error rather than a review comment if the read path ever grows a dependency # on the write path. `scripts/maps` enables it. write = ["dep:zstd-rs"] [lib] name = "tilecodec" path = "src/lib.rs" [dependencies] miniz_oxide.workspace = true # Pure-Rust zstd decoder for v9 bodies (no C toolchain, so the # aarch64-linux-android cdylib keeps its single-pure-Rust-dependency # property — see the crate docs above). Decode-only here; the host-side # encoder arrives with the writer change. ruzstd.workspace = true # Pure-Rust zstd encoder, host-side only (writer): v9 bodies. Optional so the # cdylib never links it — Android reads archives, it never writes one. zstd-rs = { workspace = true, optional = true } [dev-dependencies] # Tests build archives, so they need the writer the Android cdylib never links. # Self dev-dependency (same pattern as :library:map and maps) enables `write` # only for test targets; the default lib build stays read-only. tilecodec = { path = ".", features = ["write"] }