-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The `JsonPointer` type ought to be `#[repr(transparent)]` if `std::mem::transmute` is going to be used to coerce one from a `str`. `ReferenceToken` already did. The `validate` method did not ensure that a string starts with a `/`. This may not have led a direct path to any undefined behavior, because it was ensured that all `~` are followed by a `0` or `1`, but other methods do act as though they assumed a pointer string always starts with a `/`. I think this makes things a bit more clear. The private `token_end` can be mostly replaced by `find("/")`. `as_array_index` can be implemented in terms of the standard library's integer parsing. (Allowing "+000" is an annoying gotcha in seemingly every major language's standard library!). I've added `Deserialize` for `&JsonPointer`. I've made the internals of the new `json_pointer!` macro `const {}` to better ensure that its checks actually happen at compile time. I've adjusted some methods to reduce the total number of `unsafe` blocks necessary.
- Loading branch information
Showing
2 changed files
with
100 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters