Skip to main content

build_context

Function build_context 

Source
pub fn build_context<'a>(
    data: impl IntoIterator<Item = (&'a String, &'a Value)>,
) -> ExpressionResult<Context<'a>>
Available on crate feature expression only.
Expand description

Build a CEL Context from any iterable of (key, value) pairs.

Accepts &HashMap<String, Value>, &serde_json::Map<String, Value>, or any other type that iterates over (&String, &Value). This avoids unnecessary cloning when converting between map types.

Each key-value pair is added as a top-level variable in the CEL execution context. Supports all JSON types via the cel json feature (serde integration).