facet-path
facet-path
Path tracking for navigating Facet type structures.
This crate provides lightweight path tracking that records navigation steps through a Facet type hierarchy. When an error occurs during serialization or deserialization, the path can be used to produce helpful error messages showing exactly where in the data structure the problem occurred.
Features
- Lightweight
PathStepenum that stores indices, not strings - Reconstruct human-readable paths by replaying steps against a
Shape - Optional
prettyfeature for rich error rendering withfacet-pretty
Usage
use ;
// Build a path during traversal
let mut path = new;
path.push; // first field
path.push; // third element
path.push; // second field of that element
// Format the path using the original Shape
let formatted = path.format_with_shape;
// => "outer.items[2].name"
Feature Flags
std(default): Enables standard library supportalloc: Enables heap allocation without full stdpretty: Enables rich error rendering withfacet-pretty
Sponsors
Thanks to all individual sponsors:
...along with corporate sponsors:
...without whom this work could not exist.
Special thanks
The facet logo was drawn by Misiasart.
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.