Expression

Enum Expression 

Source
pub enum Expression {
Show 62 variants IntLiteral { value: i64, }, Int64Literal { value: i64, }, FloatLiteral { value: f64, }, StringLiteral { value: String, }, BoolLiteral { value: bool, }, Null, Param { index: u32, }, FieldAccess { object: Box<Expression>, class_name: String, field_name: String, field_type: WasmFieldType, }, Eq { left: Box<Expression>, right: Box<Expression>, }, Ne { left: Box<Expression>, right: Box<Expression>, }, Lt { left: Box<Expression>, right: Box<Expression>, }, Le { left: Box<Expression>, right: Box<Expression>, }, Gt { left: Box<Expression>, right: Box<Expression>, }, Ge { left: Box<Expression>, right: Box<Expression>, }, Eq64 { left: Box<Expression>, right: Box<Expression>, }, Ne64 { left: Box<Expression>, right: Box<Expression>, }, Lt64 { left: Box<Expression>, right: Box<Expression>, }, Le64 { left: Box<Expression>, right: Box<Expression>, }, Gt64 { left: Box<Expression>, right: Box<Expression>, }, Ge64 { left: Box<Expression>, right: Box<Expression>, }, And { left: Box<Expression>, right: Box<Expression>, }, Or { left: Box<Expression>, right: Box<Expression>, }, Not { operand: Box<Expression>, }, IsNull { operand: Box<Expression>, }, IsNotNull { operand: Box<Expression>, }, IsNull64 { operand: Box<Expression>, }, IsNotNull64 { operand: Box<Expression>, }, Add { left: Box<Expression>, right: Box<Expression>, }, Sub { left: Box<Expression>, right: Box<Expression>, }, Mul { left: Box<Expression>, right: Box<Expression>, }, Div { left: Box<Expression>, right: Box<Expression>, }, Add64 { left: Box<Expression>, right: Box<Expression>, }, Sub64 { left: Box<Expression>, right: Box<Expression>, }, Mul64 { left: Box<Expression>, right: Box<Expression>, }, Div64 { left: Box<Expression>, right: Box<Expression>, }, FloatAdd { left: Box<Expression>, right: Box<Expression>, }, FloatSub { left: Box<Expression>, right: Box<Expression>, }, FloatMul { left: Box<Expression>, right: Box<Expression>, }, FloatDiv { left: Box<Expression>, right: Box<Expression>, }, Sqrt { operand: Box<Expression>, }, FloatAbs { operand: Box<Expression>, }, Round { operand: Box<Expression>, }, Floor { operand: Box<Expression>, }, Ceil { operand: Box<Expression>, }, Sin { operand: Box<Expression>, }, Cos { operand: Box<Expression>, }, Asin { operand: Box<Expression>, }, Acos { operand: Box<Expression>, }, Atan { operand: Box<Expression>, }, Atan2 { y: Box<Expression>, x: Box<Expression>, }, Radians { operand: Box<Expression>, }, IntToFloat { operand: Box<Expression>, }, FloatToInt { operand: Box<Expression>, }, ListContains { list: Box<Expression>, element: Box<Expression>, }, Length { collection: Box<Expression>, }, Sum { collection: Box<Expression>, item_var_name: String, item_param_index: u32, item_class_name: String, accumulator_expr: Box<Expression>, }, LastElement { collection: Box<Expression>, item_class_name: String, }, HostCall { function_name: String, args: Vec<Expression>, }, IfThenElse { condition: Box<Expression>, then_branch: Box<Expression>, else_branch: Box<Expression>, }, IfThenElse64 { condition: Box<Expression>, then_branch: Box<Expression>, else_branch: Box<Expression>, }, I64ToI32 { operand: Box<Expression>, }, I32ToI64 { operand: Box<Expression>, },
}
Expand description

Rich expression tree for constraint predicates

This enum represents a complete expression language for building constraint predicates. Expressions are serializable (via serde) for use across FFI boundaries.

Variants§

§

IntLiteral

Integer literal (i64) - compiles to i32 in WASM

Fields

§value: i64
§

Int64Literal

64-bit integer literal - compiles directly to i64 in WASM

Fields

§value: i64
§

FloatLiteral

Float literal (f64)

Fields

§value: f64
§

StringLiteral

String literal

Fields

§value: String
§

BoolLiteral

Boolean literal

Fields

§value: bool
§

Null

Null value

§

Param

Access a function parameter by index

Fields

§index: u32
§

FieldAccess

Access a field on an object

Fields

§object: Box<Expression>
§class_name: String
§field_name: String
§field_type: WasmFieldType

WASM type of the field for type inference. Defaults to Object for unknown types.

§

Eq

Equal comparison (==)

Fields

§

Ne

Not equal comparison (!=)

Fields

§

Lt

Less than comparison (<)

Fields

§

Le

Less than or equal comparison (<=)

Fields

§

Gt

Greater than comparison (>)

Fields

§

Ge

Greater than or equal comparison (>=)

Fields

§

Eq64

Equal comparison for i64

Fields

§

Ne64

Not equal comparison for i64

Fields

§

Lt64

Less than comparison for i64

Fields

§

Le64

Less than or equal comparison for i64

Fields

§

Gt64

Greater than comparison for i64

Fields

§

Ge64

Greater than or equal comparison for i64

Fields

§

And

Logical AND (&&)

Fields

§

Or

Logical OR (||)

Fields

§

Not

Logical NOT (!)

Fields

§operand: Box<Expression>
§

IsNull

Null check (is null) - for i32 operands

Fields

§operand: Box<Expression>
§

IsNotNull

Not-null check (is not null) - for i32 operands

Fields

§operand: Box<Expression>
§

IsNull64

Null check (is null) - for i64 operands

Fields

§operand: Box<Expression>
§

IsNotNull64

Not-null check (is not null) - for i64 operands

Fields

§operand: Box<Expression>
§

Add

Addition (+)

Fields

§

Sub

Subtraction (-)

Fields

§

Mul

Multiplication (*)

Fields

§

Div

Division (/)

Fields

§

Add64

Addition for i64

Fields

§

Sub64

Subtraction for i64

Fields

§

Mul64

Multiplication for i64

Fields

§

Div64

Division for i64

Fields

§

FloatAdd

Float addition (f64)

Fields

§

FloatSub

Float subtraction (f64)

Fields

§

FloatMul

Float multiplication (f64)

Fields

§

FloatDiv

Float division (f64)

Fields

§

Sqrt

Square root (WASM f64.sqrt intrinsic)

Fields

§operand: Box<Expression>
§

FloatAbs

Absolute value for floats (WASM f64.abs intrinsic)

Fields

§operand: Box<Expression>
§

Round

Round to nearest integer (WASM f64.nearest intrinsic)

Fields

§operand: Box<Expression>
§

Floor

Floor (WASM f64.floor intrinsic)

Fields

§operand: Box<Expression>
§

Ceil

Ceiling (WASM f64.ceil intrinsic)

Fields

§operand: Box<Expression>
§

Sin

Sine (host call)

Fields

§operand: Box<Expression>
§

Cos

Cosine (host call)

Fields

§operand: Box<Expression>
§

Asin

Arc sine (host call)

Fields

§operand: Box<Expression>
§

Acos

Arc cosine (host call)

Fields

§operand: Box<Expression>
§

Atan

Arc tangent (host call)

Fields

§operand: Box<Expression>
§

Atan2

Arc tangent of y/x (host call)

§

Radians

Convert degrees to radians

Fields

§operand: Box<Expression>
§

IntToFloat

Convert int to float

Fields

§operand: Box<Expression>
§

FloatToInt

Convert float to int (truncating)

Fields

§operand: Box<Expression>
§

ListContains

Check if a list contains an element

Fields

§element: Box<Expression>
§

Length

Get the length of a collection

Fields

§collection: Box<Expression>
§

Sum

Sum of field values over a collection

Fields

§collection: Box<Expression>
§item_var_name: String
§item_param_index: u32
§item_class_name: String
§accumulator_expr: Box<Expression>
§

LastElement

Access the last element of a collection

Fields

§collection: Box<Expression>
§item_class_name: String
§

HostCall

Call a host-provided function

Fields

§function_name: String
§

IfThenElse

If-then-else conditional expression (produces i32)

Fields

§condition: Box<Expression>
§then_branch: Box<Expression>
§else_branch: Box<Expression>
§

IfThenElse64

If-then-else conditional expression (produces i64)

Fields

§condition: Box<Expression>
§then_branch: Box<Expression>
§else_branch: Box<Expression>
§

I64ToI32

Wrap i64 to i32 (truncate)

Fields

§operand: Box<Expression>
§

I32ToI64

Extend i32 to i64 (signed)

Fields

§operand: Box<Expression>

Implementations§

Source§

impl Expression

Source

pub fn substitute_param( self, from_index: u32, substitute: &Expression, ) -> Expression

Substitute all occurrences of a parameter with a replacement expression.

This is used for method inlining: when inlining obj.method(), we replace Param(0) (self) with obj, and other parameters with their call arguments.

Trait Implementations§

Source§

impl Clone for Expression

Source§

fn clone(&self) -> Expression

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Expression

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Expression

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 FieldAccessExt for Expression

Source§

fn get(self, class_name: &str, field_name: &str) -> Expression

Access a field on this expression
Source§

impl IntoNamedExpression for Expression

Source§

fn named(self) -> NamedExpression

Converts to a NamedExpression with an auto-generated name.
Source§

fn named_as(self, name: impl Into<String>) -> NamedExpression

Converts to a NamedExpression with the given name.
Source§

impl PartialEq for Expression

Source§

fn eq(&self, other: &Expression) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Expression

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
Source§

impl StructuralPartialEq for Expression

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

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