Make header methods publicly readable#110
Conversation
This was in pursuit of adding a CLI client for the pmtiles-rs crate. See github.com/michaelkirk/pmtiles-rs-cli
There was a problem hiding this comment.
Pull request overview
This PR exposes additional read-only Header information via public accessor methods, to support external consumers (e.g., the extracted CLI tool) without making the underlying fields publicly mutable.
Changes:
- Add public getters on
Headerfor spec version, addressed/entry/content tile counts, clustering flag, and internal directory compression.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/header.rs
Outdated
| } | ||
| } | ||
|
|
||
| /// Get the version specification of the archive |
There was a problem hiding this comment.
Doc comment wording here is a bit unclear/grammatically awkward ("version specification"), and it’s missing a trailing period. Consider rephrasing to something like “Get the PMTiles spec version of the archive.” for clearer public API docs.
| /// Get the version specification of the archive | |
| /// Get the PMTiles spec version of the archive. |
There was a problem hiding this comment.
please apply this - it seems you created this PR either from an org or without giving maintainers edit rights. Otherwise good to go
There was a problem hiding this comment.
I did previously, but then pedantic clippy got mad, so I reverted it, because it didn't seem worth it.
I'll dig around for an appropriate allow rule so we can all feel really good about this change.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #110 +/- ##
==========================================
- Coverage 78.84% 77.84% -1.00%
==========================================
Files 11 11
Lines 1404 1422 +18
Branches 1404 1422 +18
==========================================
Hits 1107 1107
- Misses 192 210 +18
Partials 105 105 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ba750ec to
178760c
Compare
|
Looks good to me @michaelkirk. Why the use of |
|
🤓 Methods that return I was trying to follow existing patterns, but I don't really care either way. I see now that the code base isn't entirely consistent about this.
getters without
FWIW, my own thinking is that
Do you want me to remove the |
|
must_use use is usually driven by clippy complaining :) |
|
i would just keep it if it makes clippy happy |
|
Indeed clippy complains if they are removed. It makes me question the projects use of clippy |
|
heh, one of those minor pesky things... i did find must_use useful as a user of the lib, and its a small price to pay i guess |
src/header.rs
Outdated
| } | ||
| } | ||
|
|
||
| #[allow(clippy::doc_markdown)] |
There was a problem hiding this comment.
why not simply fix the doc comment with backticks?
There was a problem hiding this comment.
I had McDonald's for lunch.
I had
McDonaldsfor lunch.
I'm writing documentation for people, not to appease clippy!
It just so happens that PMTiles PMTiles is conventionally capitalized in a way that it looks like a type in rust, but I'm referring to the proper noun, not to any code element (we don't even have a PMTiles type).
All that said, I don't really care that much. If you want me to write docs for clippy rather than people, I'll do it!
There was a problem hiding this comment.
are you unhappy with our machine overlord?!? Borgs won't be happy with you... You should have had Burger King... that said, if you look in the code base, all PMTiles have backticks around them in the docs - keeps things simpler :)
|
P.S. @lseelenbinder as mentioned above, I wouldn't worry about a few extra must_use - they did save me a few times, not really worth excluding that lint |
|
Agreed @nyurik! Let's keep clippy happy. 😃 I was mainly curious. |
## 🤖 New release
* `pmtiles`: 0.19.2 -> 0.20.0 (⚠ API breaking changes)
### ⚠ `pmtiles` breaking changes
```text
--- failure enum_variant_added: enum variant added on exhaustive enum ---
Description:
A publicly-visible enum without #[non_exhaustive] has a new variant.
ref: https://doc.rust-lang.org/cargo/reference/semver.html#enum-variant-new
impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.46.0/src/lints/enum_variant_added.ron
Failed in:
variant PmtError:InvalidTileId in /tmp/.tmpxfPXJO/pmtiles-rs/src/error.rs:93
```
<details><summary><i><b>Changelog</b></i></summary><p>
<blockquote>
##
[0.20.0](v0.19.2...v0.20.0)
- 2026-02-20
### Other
- Make header methods publicly readable
([#110](#110))
- Return Result from TileId::new instead of Option
([#107](#107))
</blockquote>
</p></details>
---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).

Followup to #108, in which I attempted to add a CLI bin to this crate. There was a bit of friction, so instead I've extracted the CLI code to https://github.com/michaelkirk/pmtiles-rs-cli
Still, it requires some modest changes to the library code.