pub fn resolve_path(
root: &Value,
path: &str,
addressing: Addressing<'_>,
) -> DocumentResult<String>Expand description
Rewrite path into the equivalent index-only address for root.
Content addressing is something only the parsed value can answer, and the
source-preserving writers never see it: each backend re-walks the original
text by path, and nothing in identities.me tells a TOML editor which
element me is. So a write resolves the address once, here, where the whole
document is in hand, and hands the backends the canonical identities.0.
The alternative — teaching six backends to match on content — would give
each its own chance to disagree with the read walk about what an address
means.
Resolution stops at the first segment the document does not have and copies
the rest verbatim, because set creates missing object parents and a node
that does not exist yet cannot be addressed by its content anyway. Whatever
is wrong with the tail is then the writer’s error to report, unchanged.
Two prefixes are tracked because they answer different questions: the
semantic one (the caller’s own segments) is what a KeyedList
registration is matched against, so a registration keeps meaning what it
meant on the read path, while the canonical one (resolved indices) is what
gets returned.