Expression

Enum Expression 

Source
pub enum Expression {
Show 17 variants IntLiteral(i64), FloatLiteral(f64), StringLiteral(String), BoolLiteral(bool), NullLiteral, ArrayLiteral(Vec<Expression>), ObjectLiteral(Vec<(String, Expression)>), Range { start: Box<Expression>, end: Box<Expression>, }, Variable(String), Binary { op: BinaryOp, left: Box<Expression>, right: Box<Expression>, }, Unary { op: UnaryOp, operand: Box<Expression>, }, Ternary { condition: Box<Expression>, then_expr: Box<Expression>, else_expr: Box<Expression>, }, ToolCall { name: String, args: Vec<Argument>, }, Lambda { params: Vec<String>, body: Box<Expression>, }, FieldAccess { object: Box<Expression>, field: String, }, IndexAccess { array: Box<Expression>, index: Box<Expression>, }, Grouping(Box<Expression>),
}
Expand description

Expressions

Variants§

§

IntLiteral(i64)

Integer literal expression

§

FloatLiteral(f64)

Floating-point literal expression

§

StringLiteral(String)

String literal expression

§

BoolLiteral(bool)

Boolean literal expression

§

NullLiteral

Null literal expression

§

ArrayLiteral(Vec<Expression>)

Array literal expression

§

ObjectLiteral(Vec<(String, Expression)>)

Object literal expression with key-value pairs

§

Range

Range expression [start..end]

Fields

§start: Box<Expression>

Start expression of the range

§end: Box<Expression>

End expression of the range (exclusive)

§

Variable(String)

Variable reference expression

§

Binary

Binary operation expression

Fields

§op: BinaryOp

Binary operator to apply

§left: Box<Expression>

Left operand expression

§right: Box<Expression>

Right operand expression

§

Unary

Unary operation expression

Fields

§op: UnaryOp

Unary operator to apply

§operand: Box<Expression>

Operand expression

§

Ternary

Ternary conditional expression

Fields

§condition: Box<Expression>

Condition expression to evaluate

§then_expr: Box<Expression>

Expression to evaluate if condition is true

§else_expr: Box<Expression>

Expression to evaluate if condition is false

§

ToolCall

Tool or function call

Fields

§name: String

Name of the tool/function to call

§args: Vec<Argument>

Arguments to pass to the tool

§

Lambda

Lambda function expression (x => x * 2)

Fields

§params: Vec<String>

Parameter names for the lambda

§body: Box<Expression>

Body expression of the lambda

§

FieldAccess

Field access expression (object.field)

Fields

§object: Box<Expression>

Object being accessed

§field: String

Name of the field to access

§

IndexAccess

Index access expression (array[index])

Fields

§array: Box<Expression>

Array or collection being indexed

§index: Box<Expression>

Index expression

§

Grouping(Box<Expression>)

Grouping expression with parentheses (expr)

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 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, 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 = 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,