Skip to main content

CompositeEngineConfig

Struct CompositeEngineConfig 

Source
pub struct CompositeEngineConfig {
    pub rego_rules: Vec<ExternalRuleSource>,
    pub cel_rules: Vec<ExternalRuleSource>,
    pub guard_rules: Vec<ExternalRuleSource>,
    pub schema_validator_config: Option<SchemaValidatorConfig>,
}
Expand description

Configuration for a composite engine that evaluates the built-in rules with one engine and caller-supplied external rules with another.

The built-in rules are always evaluated, so this config only carries the external rules layered on top plus the shared schema configuration. Custom rules can be supplied in all three formats: Rego rules are evaluated by the external engine, while CEL custom rules and Guard rules are evaluated by the engine that owns the built-ins. It has no field for engine-native built-in custom rules because the composite fixes which engine owns the built-ins.

Fields§

§rego_rules: Vec<ExternalRuleSource>

Custom Rego rules layered on top of the built-in rules.

§cel_rules: Vec<ExternalRuleSource>

Custom CEL rules layered on top of the built-in rules. They are evaluated by the same engine that owns the built-ins, since CEL custom rules are a CEL-engine feature.

§guard_rules: Vec<ExternalRuleSource>

Guard DSL rules as raw source text, layered on top of the built-in rules.

§schema_validator_config: Option<SchemaValidatorConfig>

Optional schema validator configuration. A standalone engine derives its schema-aware rule metadata from this config. Language APIs also use it to construct the schema validator bundled with the engine, so both components observe the same additional schemas.

Implementations§

Source§

impl CompositeEngineConfig

Source

pub fn new() -> Self

Starts from the default configuration.

Source

pub fn with_rego_rules( self, rules: impl IntoIterator<Item = ExternalRuleSource>, ) -> Self

Adds custom Rego rules layered on top of the built-in rules.

Source

pub fn with_cel_rules( self, rules: impl IntoIterator<Item = ExternalRuleSource>, ) -> Self

Adds custom CEL rules layered on top of the built-in rules. They are evaluated by the engine that owns the built-ins.

Source

pub fn with_guard_rules( self, rules: impl IntoIterator<Item = ExternalRuleSource>, ) -> Self

Adds Guard DSL rules layered on top of the built-in rules.

Source

pub fn with_schema_validator_config(self, config: SchemaValidatorConfig) -> Self

Sets the nested schema validator configuration so both the built-in and external evaluation observe the same additional schemas.

Trait Implementations§

Source§

impl Clone for CompositeEngineConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for CompositeEngineConfig

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for CompositeEngineConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for CompositeEngineConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.