Skip to main content

ComputedVariable

Trait ComputedVariable 

Source
pub trait ComputedVariable: Send + Sync {
    // Required methods
    fn evaluate(&self, context: &VariableContext) -> Result<Value>;
    fn cache_key(&self) -> String;
    fn is_expensive(&self) -> bool;
}
Expand description

Trait for computed variables that evaluate on demand

Required Methods§

Source

fn evaluate(&self, context: &VariableContext) -> Result<Value>

Evaluate the variable in the given context

Source

fn cache_key(&self) -> String

Cache key for this variable

Source

fn is_expensive(&self) -> bool

Whether this computation is expensive

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§