Expand description
Allocation-free source-location tracking (“backtraces”) for JsonValue.
Pairs a value or error with a precise position in a JSON document, or across several documents, without allocating until a location is actually needed:
JsonBacktraceBuilderincrementally builds a location as a borrow-chain stack while walking a document; callJsonBacktraceBuilder::buildto turn it into an ownedJsonBacktraceBuf.- A
JsonBacktraceBuf/JsonBacktraceis a sequence ofJsonBacktraceFrames, one per file crossed, each holding aJsonFragmentPathBuf/JsonFragmentPathofJsonFragmentPathSegment/JsonFragmentPathItemRefnavigation steps within that file. JsonLocated(and theJsonAt/JsonErrorAthelper traits) pairs a value or error with itsJsonBacktraceBuf.JsonValue::locate_fragmentresolves a path back to a byte offset, given theJsonCodeMapproduced when the document was parsed.
Structs§
- Json
Backtrace Frame - A single frame of a
JsonBacktraceBuf: the file a fragment was found in, and the path to that fragment within it. - Json
Located - A value paired with a source location.
Enums§
- Json
Backtrace Builder - Incrementally builds a
JsonBacktraceBufas a borrow-chain stack, without allocating untilSelf::buildis called. - Json
Fragment Path Item Ref - Borrowed form of
JsonFragmentPathSegment, used while building a backtrace to avoid allocating untilJsonBacktraceBuilder::buildis called. - Json
Fragment Path Segment - Owned form of a single path navigation step, as recorded in a
JsonBacktraceFrame. - Json
Object Entry Part - Which part of an object entry a
JsonFragmentPathSegment::ObjectEntry(orJsonFragmentPathItemRef::ObjectEntry) targets.
Traits§
- JsonAt
- Pairs any value with a location, producing a
JsonLocated. - Json
Error At - Pairs the error of a
Result, if any, with a location.
Type Aliases§
- Json
Backtrace - Borrowed form of a
JsonBacktraceBuf. - Json
Backtrace Buf - Describes the exact location of a JSON fragment within a document, or across several documents.
- Json
Fragment Path - Borrowed form of a
JsonFragmentPathBuf. - Json
Fragment Path Buf - Owned sequence of path segments, from outermost to innermost.