pub struct ExprEngineBuilder { /* private fields */ }Expand description
Builds an ExprEngine.
Defaults to OperatorFamily::Core (and OperatorFamily::Secret) only.
Select optional operator families at runtime with family,
families or all_operators.
Implementations§
Source§impl ExprEngineBuilder
impl ExprEngineBuilder
Sourcepub fn family(self, family: OperatorFamily) -> Self
pub fn family(self, family: OperatorFamily) -> Self
Enables one built-in OperatorFamily.
Enabling a family is not a no-op for existing workflows: under
templating mode an unknown operator name passes through as literal data,
so {"length": ...} starts evaluating once
OperatorFamily::ExtString is enabled ({"$length": ...} pins the
literal). OperatorFamily::Datetime and OperatorFamily::Tensor
also require their cargo features (datetime, tensor) to be enabled.
Sourcepub fn families(
self,
families: impl IntoIterator<Item = OperatorFamily>,
) -> Self
pub fn families( self, families: impl IntoIterator<Item = OperatorFamily>, ) -> Self
Enables each built-in OperatorFamily in families.
Sourcepub fn all_operators(self) -> Self
pub fn all_operators(self) -> Self
Enables the standard optional operator families:
ExtString,
ExtArray,
ExtMath,
ExtControl,
ExtObject,
ErrorHandling, and (when the
datetime cargo feature is enabled)
Datetime.
OperatorFamily::Tensor is deliberately left out: names like
shape, full, cast and concat are ordinary JSON keys, which a
live operator would start evaluating.
Sourcepub fn operator(
self,
name: impl Into<String>,
op: impl CustomOperator + 'static,
) -> Self
pub fn operator( self, name: impl Into<String>, op: impl CustomOperator + 'static, ) -> Self
Registers a custom operator, neither scoping nor deterministic.
§Dependency
op is a datalogic_rs::CustomOperator,
named through this crate’s re-export. It is part of the committed
dependency surface, as OwnedDataValue
is: wrapping it would still take datalogic’s value and arena types, so
the engine keeps the trait itself.
Sourcepub fn operator_with(
self,
info: Operator,
op: impl CustomOperator + 'static,
) -> Self
pub fn operator_with( self, info: Operator, op: impl CustomOperator + 'static, ) -> Self
Registers a custom operator with its own flags. The family is always
OperatorFamily::Custom; op is a
datalogic_rs::CustomOperator,
the committed dependency type operator documents.
Sourcepub fn ops_budget(self, ops: u64) -> Self
pub fn ops_budget(self, ops: u64) -> Self
Sets the ceiling on operations per evaluation.
Sourcepub fn build(self) -> Result<ExprEngine>
pub fn build(self) -> Result<ExprEngine>
Builds the engine, with OperatorFamily::Core,
OperatorFamily::Secret and the families selected on this builder,
and no other. ErrorKind::Config when OperatorFamily::Custom or
an uncompiled cargo-feature family (Datetime, Tensor) is requested,
or when a custom operator is named secret, is named like a built-in
operator of the selected families, or is registered twice.