Skip to main content

ExprEngineBuilder

Struct ExprEngineBuilder 

Source
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

Source

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.

Source

pub fn families( self, families: impl IntoIterator<Item = OperatorFamily>, ) -> Self

Enables each built-in OperatorFamily in families.

Source

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.

Source

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.

Source

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.

Source

pub fn secrets(self, secrets: Secrets) -> Self

Sets the secrets the secret operator reads.

Source

pub fn ops_budget(self, ops: u64) -> Self

Sets the ceiling on operations per evaluation.

Source

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.

Trait Implementations§

Source§

impl Debug for ExprEngineBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

The selected families, the custom operators’ names and the secrets, redacted.

Source§

impl Default for ExprEngineBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.