pub struct PredicateDefinition {
pub name: String,
pub arity: u32,
pub body: PredicateBody,
pub param_types: Option<Vec<ValType>>,
}Fields§
§name: String§arity: u32§body: PredicateBody§param_types: Option<Vec<ValType>>Parameter types for the predicate function. If None, defaults to all i32.
Implementations§
Source§impl PredicateDefinition
impl PredicateDefinition
pub fn new(name: impl Into<String>, arity: u32, comparison: Comparison) -> Self
pub fn from_expression( name: impl Into<String>, arity: u32, expression: Expression, ) -> Self
Sourcepub fn from_expression_with_types(
name: impl Into<String>,
param_types: Vec<ValType>,
expression: Expression,
) -> Self
pub fn from_expression_with_types( name: impl Into<String>, param_types: Vec<ValType>, expression: Expression, ) -> Self
Create a predicate from an expression with explicit parameter types. Useful for functions that take non-i32 parameters (e.g., f32 for loadBalance unfairness).
pub fn always_true(name: impl Into<String>, arity: u32) -> Self
pub fn equal( name: impl Into<String>, left: FieldAccess, right: FieldAccess, ) -> Self
Trait Implementations§
Source§impl Clone for PredicateDefinition
impl Clone for PredicateDefinition
Source§fn clone(&self) -> PredicateDefinition
fn clone(&self) -> PredicateDefinition
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PredicateDefinition
impl RefUnwindSafe for PredicateDefinition
impl Send for PredicateDefinition
impl Sync for PredicateDefinition
impl Unpin for PredicateDefinition
impl UnwindSafe for PredicateDefinition
Blanket Implementations§
Source§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