Skip to main content

Module json

Module json 

Source
Expand description

The shared JSON shape of requests and results (see harness/lib/serialize.js and tests/golden/README.md). Used by the golden runner and the chrono-rs-json CLI.

Structs§

Request
A parse request in the golden-case / harness shape.

Functions§

byte_index
JavaScript string index (UTF-16 code units) -> byte offset, or None inside a character.
components_to_json
parse_request
Parses {text, config, reference, options}. Unknown option keys are an error (fail closed).
result_from_json
The inverse of result_to_json, for a result in the context of text and reference. Component key order isn’t carried (it doesn’t affect any output, only iteration order).
result_to_json
One result; text is the full parsed text, to convert index to UTF-16.
results_to_json
utf16_index
Byte offset -> JavaScript string index (UTF-16 code units).