liver-shot 1.1.0

Lightweight no_std JSON value position extractor
Documentation
  • Coverage
  • 16.67%
    1 out of 6 items documented1 out of 2 items with examples
  • Size
  • Source code size: 28.59 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.25 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 37s Average build duration of successful builds.
  • all releases: 32s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • m3idnotfree/liver-short
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • m3idnotfree

liver-shot

Documentation

A lightweight, no_std JSON value position extractor.

Returns a Span (start/end byte offsets) rather than a parsed value, so the caller decides how to use the original string.

Limitations

  • Object navigation only - arrays at the top level or as a path step return Error::is_unsupported_array.
  • Values are not validated — only their position is extracted.

Examples

Extract an object

let json = r#"{"a": {"b": "value", "c": [1, 2, 3]}}"#;

let span = liver_shot::find("a", json)?;
assert_eq!(r#"{"b": "value", "c": [1, 2, 3]}"#, span.get(json));

Extract a nested object

let json = r#"{"a": {"b": {"c": "value"}}}"#;

let span = liver_shot::find("a.b", json)?;
assert_eq!(r#"{"c": "value"}"#, span.get(json));

Extract an array

let json = r#"{"a": {"b": "value", "c": [1, 2, 3]}}"#;

let span = liver_shot::find("a.c", json)?;
assert_eq!("[1, 2, 3]", span.get(json));

Reuse Span

let json = r#"{"a": {"b": "value", "c": [1, 2, 3]}}"#;

let a = liver_shot::find("a", json)?;
let b   = a.find("b", json)?;
let c = a.find("c", json)?;

assert_eq!(r#"{"b": "value", "c": [1, 2, 3]}"#, a.get(json));
assert_eq!(r#""value""#, b.get(json));
assert_eq!("[1, 2, 3]", c.get(json));

License

Licensed under either of:

  • Apache License, Version 2.0
  • MIT license