pub struct CelConstraint {
pub id: &'static str,
pub message: &'static str,
pub expression: &'static str,
/* private fields */
}Fields§
§id: &'static str§message: &'static str§expression: &'static strImplementations§
Source§impl CelConstraint
impl CelConstraint
pub const fn new( id: &'static str, message: &'static str, expression: &'static str, ) -> Self
Sourcepub fn eval_value_at(
&self,
this: Value,
field_path: FieldPath,
cel_index: u64,
) -> Result<(), Violation>
pub fn eval_value_at( &self, this: Value, field_path: FieldPath, cel_index: u64, ) -> Result<(), Violation>
Evaluates this CEL expression against this (bound as the this variable
inside the expression) plus a per-call-frozen now timestamp.
§Errors
Returns a Violation when the compiled CEL expression returns
false, returns a non-empty string, or produces a runtime error.
§Panics
Panics at first call if the CEL expression fails to compile (it is
baked in at codegen time, so a parse failure indicates a plugin bug).
Evaluate this CEL expression with this bound to the supplied raw
crate::cel_core::Value (used for scalar-field-level CEL rules where
the “this” target is a primitive, not a message). The violation’s
field path is set from field_path and rule path is set to
[cel[index]] reflecting position in the repeated FieldRules.cel.
Sourcepub fn eval_expr_value_at(
&self,
this: Value,
field_path: FieldPath,
index: u64,
) -> Result<(), Violation>
pub fn eval_expr_value_at( &self, this: Value, field_path: FieldPath, index: u64, ) -> Result<(), Violation>
Sourcepub fn eval_repeated_items_cel(
&self,
this: Value,
field_path: FieldPath,
cel_idx: u64,
) -> Result<(), Violation>
pub fn eval_repeated_items_cel( &self, this: Value, field_path: FieldPath, cel_idx: u64, ) -> Result<(), Violation>
Sourcepub fn eval_map_keys_cel(
&self,
this: Value,
field_path: FieldPath,
cel_idx: u64,
) -> Result<(), Violation>
pub fn eval_map_keys_cel( &self, this: Value, field_path: FieldPath, cel_idx: u64, ) -> Result<(), Violation>
Sourcepub fn eval_map_values_cel(
&self,
this: Value,
field_path: FieldPath,
cel_idx: u64,
) -> Result<(), Violation>
pub fn eval_map_values_cel( &self, this: Value, field_path: FieldPath, cel_idx: u64, ) -> Result<(), Violation>
Sourcepub fn eval_predefined(
&self,
this: Value,
rule: Value,
field_path: FieldPath,
rule_path: FieldPath,
) -> Result<(), Violation>
pub fn eval_predefined( &self, this: Value, rule: Value, field_path: FieldPath, rule_path: FieldPath, ) -> Result<(), Violation>
Sourcepub fn eval<T: AsCelValue>(&self, this: &T) -> Result<(), Violation>
pub fn eval<T: AsCelValue>(&self, this: &T) -> Result<(), Violation>
Evaluate with this bound via the AsCelValue trait.
§Errors
Returns a Violation when the CEL expression rejects this or when
a non-skippable runtime error occurs.
§Panics
Panics if the CEL expression fails to compile (baked in at codegen time).
Auto Trait Implementations§
impl !Freeze for CelConstraint
impl RefUnwindSafe for CelConstraint
impl Send for CelConstraint
impl Sync for CelConstraint
impl Unpin for CelConstraint
impl UnsafeUnpin for CelConstraint
impl UnwindSafe for CelConstraint
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind referenceSource§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable referenceSource§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointerSource§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointer