MCPcopy Index your code
hub / github.com/AI45Lab/Code / render_template_value

Function render_template_value

core/src/program.rs:835–855  ·  view source on GitHub ↗
(
    value: &serde_json::Value,
    bindings: &serde_json::Value,
)

Source from the content-addressed store, hash-verified

833}
834
835fn render_template_value(
836 value: &serde_json::Value,
837 bindings: &serde_json::Value,
838) -> serde_json::Value {
839 match value {
840 serde_json::Value::String(text) => render_template_string(text, bindings),
841 serde_json::Value::Array(items) => serde_json::Value::Array(
842 items
843 .iter()
844 .map(|item| render_template_value(item, bindings))
845 .collect(),
846 ),
847 serde_json::Value::Object(object) => serde_json::Value::Object(
848 object
849 .iter()
850 .map(|(key, value)| (key.clone(), render_template_value(value, bindings)))
851 .collect(),
852 ),
853 value => value.clone(),
854 }
855}
856
857fn render_template_string(text: &str, bindings: &serde_json::Value) -> serde_json::Value {
858 if let Some(name) = exact_placeholder_name(text) {

Callers 1

instantiateMethod · 0.85

Calls 2

render_template_stringFunction · 0.85
cloneMethod · 0.45

Tested by

no test coverage detected