Skip to main content

Module path

Module path 

Source
Expand description

jq-like path resolution against serde_json::Value.

Supports dotted segments and bracketed integer indices, e.g. data.path.text, data.lines[0].text, or .[0] for top-level array access. The leading . is optional and treated as identity-then-lookup. The bare path . resolves to the input value as-is.

Quoted segments (e.g. ."key with dot") are intentionally not supported in this slice — keys containing dots are out of scope until a later slice raises the need.

§Error shape

resolve returns Result<&Value, FaceError>. The chosen variant is FaceError::UnknownItemsPathpath::resolve does not know whether the path came from --items or --score, so the UnknownItemsPath form is used as the generic shape. Callers that distinguish the two flags re-wrap into FaceError::UnknownScorePath when appropriate (the score-resolution call site has the context). This is the simpler call shape — callers that don’t care about the distinction propagate the error as-is.

Functions§

resolve
Resolve a jq-like dotted/bracketed path against a Value.
resolve_owned
Resolve and clone the result, useful when the caller needs an owned Value (e.g. to feed it across an API boundary).