Skip to main content

interpolate

Function interpolate 

Source
pub fn interpolate(doc: Value, env: &dyn Env) -> Result<Value, InterpError>
Expand description

Resolves every reference in doc.

By value because resolution builds a new tree rather than editing in place — a referent must be read in its pre-substitution form no matter which order the document is walked in.

Call it once, on the merged document, never per layer: a reference reads the document the caller is actually going to get. Overlays therefore interpolate like any other layer, and strict mode has already run — it compares the types values had when they were written, so a "${port}" was a string when it looked.

Every unresolved reference and every malformed one is collected, so a run reports all of them. A cycle is the exception and returns alone: there is nothing meaningful to continue past.