feat(value): add ergonomic type checking and accessor methods to JsonValue - #262
Open
Aditya-9-6 wants to merge 5 commits into
Open
feat(value): add ergonomic type checking and accessor methods to JsonValue#262Aditya-9-6 wants to merge 5 commits into
Aditya-9-6 wants to merge 5 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Merging this PR will degrade performance by 5.85%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ❌ | unicode_jiter_iter |
1.2 µs | 1.4 µs | -15.95% |
| ❌ | massive_ints_array_jiter_value |
423.9 µs | 470.5 µs | -9.92% |
| ❌ | sentence_jiter_iter |
1 µs | 1.1 µs | -9.76% |
| ❌ | unicode_jiter_value |
1.3 µs | 1.4 µs | -8.64% |
| ❌ | medium_response_jiter_value |
12.7 µs | 13.9 µs | -8.24% |
| ❌ | sentence_jiter_value |
1.1 µs | 1.2 µs | -8.14% |
| ❌ | massive_ints_array_jiter_iter |
378.7 µs | 407.1 µs | -6.98% |
| ❌ | short_numbers_jiter_value |
49.2 µs | 52 µs | -5.49% |
| ⚡ | string_array_jiter_value_owned |
16.9 µs | 15 µs | +12.28% |
| ⚡ | true_array_jiter_value |
3.1 µs | 2.9 µs | +5.35% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing Aditya-9-6:main (8d3febf) with main (9e7d52f)
Aditya-9-6
force-pushed
the
main
branch
3 times, most recently
from
August 17, 2026 16:01
90aa030 to
ec12f4a
Compare
Aditya-9-6
force-pushed
the
main
branch
3 times, most recently
from
August 24, 2026 11:23
6b6643f to
2574a60
Compare
…Value Signed-off-by: Aditya Dahale <aditya.dahale@example.com>
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Currently, working with
JsonValuein pure Rust code requires matching onJsonValuevariants for every access. Adding standard accessor and type checking methods (similar toserde_json::Value) improves developer ergonomics significantly when querying or inspecting parsed JSON data.Solution
Added the following accessor methods to
JsonValue<'j>:is_null(),is_boolean(),is_number(),is_int(),is_float(),is_string(),is_array(),is_object()as_bool(),as_i64(),as_f64(),as_str(),as_array(),as_object()get(key: &str) -> Option<&JsonValue<'j>>