Skip to main content

ContextProvider

Trait ContextProvider 

Source
pub trait ContextProvider {
    // Required methods
    fn get(&self, key: &str) -> Option<&Value>;
    fn to_context(&self) -> Context;
}
Expand description

A borrowed source of values used while evaluating an expression.

Implementing this trait allows callers and custom functions to provide context values without cloning an entire Context for each evaluation.

Required Methods§

Source

fn get(&self, key: &str) -> Option<&Value>

Source

fn to_context(&self) -> Context

Materialize the values visible to the expression.

Evaluation only calls this when an expression accesses $env.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§