chanced / jsonptr

JSON Pointer (RFC 6901) implementation for Rust
Apache License 2.0
44 stars 4 forks source link

Adds `position` to `AssignError`, `ResolveError` variants, renames both errors to be less redundant #93

Open chanced opened 2 weeks ago

chanced commented 2 weeks ago

Solves #90

I'm not certain position is the right term to use here. Instinctively, I'd reach for index or idx but that may lead to confusion over Index related errors, especially those specific to parsing an Index.

This makes AssignError and ResolveError more idiomatic by reducing redundancy in renaming to Error. I'm not sure whether or not we should #[deprecate] the type aliases AssignError and ResolveError.

I regret making both errors' variants embedded structs rather than just rolling structs for each variant. I thought long and hard about splitting them out as structs but that's going to introduce far more breaking changes. While this is definitely breaking, I'm hoping that .. or simply adding a position to { } on matches won't be that much of a hassle.

codecov-commenter commented 2 weeks ago

Codecov Report

Attention: Patch coverage is 82.29167% with 34 lines in your changes missing coverage. Please review.

Project coverage is 97.1%. Comparing base (c694765) to head (45c4fde).

Files with missing lines Patch % Lines
src/resolve.rs 76.6% 32 Missing :warning:
src/assign.rs 96.3% 2 Missing :warning:
Additional details and impacted files | [Files with missing lines](https://app.codecov.io/gh/chanced/jsonptr/pull/93?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Chance) | Coverage Δ | | |---|---|---| | [src/token.rs](https://app.codecov.io/gh/chanced/jsonptr/pull/93?src=pr&el=tree&filepath=src%2Ftoken.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Chance#diff-c3JjL3Rva2VuLnJz) | `100.0% <ø> (ø)` | | | [src/assign.rs](https://app.codecov.io/gh/chanced/jsonptr/pull/93?src=pr&el=tree&filepath=src%2Fassign.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Chance#diff-c3JjL2Fzc2lnbi5ycw==) | `97.4% <96.3%> (-2.2%)` | :arrow_down: | | [src/resolve.rs](https://app.codecov.io/gh/chanced/jsonptr/pull/93?src=pr&el=tree&filepath=src%2Fresolve.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Chance#diff-c3JjL3Jlc29sdmUucnM=) | `88.9% <76.6%> (-11.1%)` | :arrow_down: | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/chanced/jsonptr/pull/93/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Chance)