serde_cursor 0.4.0

fetch the desired parts of a serde-compatible data format efficiently using a jq-like language
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use serde_cursor::Cursor;

#[test]
fn borrowed_str() {
    let json_str = r#"{"project":{"name":"serde-cursor"}}"#;
    let expected = "serde-cursor";

    type MyCursor<'a> = Cursor!(project.name: &'a str);

    let cursor: MyCursor = serde_json::from_str(json_str).unwrap();

    assert_eq!(*cursor, expected);

    let serialized = serde_json::to_string(&cursor).unwrap();
    assert_eq!(serialized, json_str);
}