Trait vrl::compiler::expression::FunctionExpression
source · pub trait FunctionExpression: Send + Sync + Debug + DynClone + Clone + 'static {
// Required methods
fn resolve(&self, ctx: &mut Context<'_>) -> Resolved;
fn type_def(&self, state: &TypeState) -> TypeDef;
// Provided methods
fn as_value(&self) -> Option<Value> { ... }
fn as_expr(&self) -> Box<dyn Expression> { ... }
}
Expand description
A trait similar to Expression
, but simplified specifically for functions.
The main difference is this trait prevents mutation of variables both at runtime
and compile time.
Required Methods§
Provided Methods§
sourcefn as_value(&self) -> Option<Value>
fn as_value(&self) -> Option<Value>
Resolves values at compile-time for constant functions.
This returns Some
for constant expressions, or None
otherwise.
sourcefn as_expr(&self) -> Box<dyn Expression>
fn as_expr(&self) -> Box<dyn Expression>
Converts this function to a normal Expression
.
Object Safety§
This trait is not object safe.