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<T: AsCelValue>(&self, this: &T) -> Result<(), Violation>
pub fn eval<T: AsCelValue>(&self, this: &T) -> 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).
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,
Attempts to downcast this to
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,
Attempts to downcast this to
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,
Attempts to downcast this to
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,
Attempts to downcast this to
T behind Arc pointerSource§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more