pub fn set_preserving(
content: &str,
path: &str,
value: &Value,
) -> DocumentResult<String>Expand description
Replace one value in a YAML source document while retaining all unrelated source bytes. Escaped keys and keyed-list routes are still rejected until they have a lossless CST path adapter.
Scalars go through the CST’s own set_value, which matches the site’s
quoting. Collections cannot: noyalib’s set_value refuses to grow a scalar
site into a sequence or mapping under any circumstances, so a collection is
emitted as a block fragment and spliced over the value’s span — see
[replace_collection_in_place], which also documents what that costs.