Skip to content

Commit 10f21aa

Browse files
committed
add v + doc dsc
2 parents f8ee8db + 5467b2d commit 10f21aa

File tree

14 files changed

+1169
-717
lines changed

14 files changed

+1169
-717
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,8 @@
5151
- Performance improvements
5252
- Change the contract for the struct of errors
5353
- **`0.7.0`**
54-
- Bug fixes and api changes
54+
- Bug fixes and api changes
55+
- **`0.7.1`**
56+
- add Display to JsonPath
57+
- **`0.7.2`**
58+
- add JsonLike trait

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "jsonpath-rust"
33
description = "The library provides the basic functionality to find the set of the data according to the filtering query."
4-
version = "0.7.0"
4+
version = "0.7.2"
55
authors = ["BorisZhguchev <[email protected]>"]
66
edition = "2021"
77
license = "MIT"

README.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -244,22 +244,26 @@ This is enum type which represents:
244244

245245
- `Slice` - a point to the passed original json
246246
- `NewValue` - a new json data that has been generated during the path( for instance length operator)
247-
- `NoValue` - indicates there is no match between given json and jsonpath in the most cases due to absent fields or inconsistent data.
247+
- `NoValue` - indicates there is no match between given json and jsonpath in the most cases due to absent fields or
248+
inconsistent data.
248249

249250
To extract data there are two methods, provided on the `value`:
250251

251252
```rust
252253
let v:JsonPathValue<Value> =...
253254
v.to_data();
254-
v.slice_or(&some_dafault_value)
255+
v.slice_or( & some_dafault_value)
255256
```
256257

257258
### Find
258259

259260
there are 4 different functions to find data inside a `value`.
260-
All take references, to increase reusability. Especially json parsing and jsonpath parsing can take significant time, compared to a simple find.
261+
All take references, to increase reusability. Especially json parsing and jsonpath parsing can take significant time,
262+
compared to a simple find.
261263

262-
The methods `find`, `find_as_path`, `find_slice` and `find_slice_ptr` take the same inputs, but handle them differently depending on your usecase. They are further described in the [docs](https://docs.rs/jsonpath-rust/latest/jsonpath_rust/enum.JsonPath.html#implementations).
264+
The methods `find`, `find_as_path`, `find_slice` and `find_slice_ptr` take the same inputs, but handle them differently
265+
depending on your usecase. They are further described in
266+
the [docs](https://docs.rs/jsonpath-rust/latest/jsonpath_rust/enum.JsonPath.html#implementations).
263267

264268
```rust
265269
use jsonpath_rust::{JsonPath, JsonPathValue};
@@ -289,12 +293,18 @@ https://docs.rs/jsonpath-rust/latest/jsonpath_rust/parser/model/enum.JsonPath.ht
289293
The internal structure of the `JsonPathIndex` can be found here:
290294
https://docs.rs/jsonpath-rust/latest/jsonpath_rust/parser/model/enum.JsonPathIndex.html
291295

296+
### JsonLike
297+
298+
The library provides a trait `JsonLike` that can be implemented for any type.
299+
This allows you to use the `JsonPath` methods on your own types.
300+
292301
## How to contribute
293302

294303
TBD
295304

296305
## How to update version
297-
- update files
298-
- commit them
299-
- add tag `git tag -a v<Version> -m "message"`
300-
- git push origin <tag_name>
306+
307+
- update files
308+
- commit them
309+
- add tag `git tag -a v<Version> -m "message"`
310+
- git push origin <tag_name>

benches/regex.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use criterion::{criterion_group, criterion_main, Criterion};
22
use jsonpath_rust::{JsonPath, JsonPathQuery};
3-
use serde_json::json;
3+
use serde_json::{json, Value};
44
use std::str::FromStr;
55

66
struct SearchData {
@@ -23,7 +23,7 @@ fn regex_perf_test_without_reuse() {
2323
}
2424

2525
fn json_path_compiling() {
26-
let _v = JsonPath::from_str(PATH).unwrap();
26+
let _v = JsonPath::<Value>::from_str(PATH).unwrap();
2727
}
2828

2929
pub fn criterion_benchmark(c: &mut Criterion) {

0 commit comments

Comments
 (0)