pub enum ValueExpr {
Show 20 variants
Literal(Value),
Variable(String),
PropertyAccess {
object: Box<ValueExpr>,
property: String,
},
ArrayIndex {
array: Box<ValueExpr>,
index: Box<ValueExpr>,
},
ObjectLiteral {
fields: Vec<ObjectField>,
},
ArrayLiteral {
items: Vec<ValueExpr>,
},
ArrayMethod {
array: Box<ValueExpr>,
method: ArrayMethodCall,
},
NumberMethod {
number: Box<ValueExpr>,
method: NumberMethodCall,
},
BinaryOp {
left: Box<ValueExpr>,
op: BinaryOperator,
right: Box<ValueExpr>,
},
UnaryOp {
op: UnaryOperator,
operand: Box<ValueExpr>,
},
Ternary {
condition: Box<ValueExpr>,
consequent: Box<ValueExpr>,
alternate: Box<ValueExpr>,
},
OptionalChain {
object: Box<ValueExpr>,
property: String,
},
NullishCoalesce {
left: Box<ValueExpr>,
right: Box<ValueExpr>,
},
Await {
expr: Box<ValueExpr>,
},
PromiseAll {
items: Vec<ValueExpr>,
},
ApiCall {
method: String,
path: PathTemplate,
body: Option<Box<ValueExpr>>,
},
Block {
bindings: Vec<(String, ValueExpr)>,
result: Box<ValueExpr>,
},
McpCall {
server_id: String,
tool_name: String,
args: Option<Box<ValueExpr>>,
},
SdkCall {
operation: String,
args: Option<Box<ValueExpr>>,
},
BuiltinCall {
func: BuiltinFunction,
args: Vec<ValueExpr>,
},
}Expand description
An expression that produces a value.
Variants§
Literal(Value)
Literal value (null, bool, number, string)
Variable(String)
Variable reference
PropertyAccess
Property access: obj.prop
ArrayIndex
Array index: arr[0]
ObjectLiteral
Object literal: { key: value, ...spread }
Fields
fields: Vec<ObjectField>ArrayLiteral
Array literal: [1, 2, 3]
ArrayMethod
Array method call
NumberMethod
Number method call: num.toFixed(), etc.
BinaryOp
Binary operation: a + b, a === b, etc.
UnaryOp
Unary operation: !a
Ternary
Ternary: cond ? a : b
OptionalChain
Optional chaining: obj?.prop
NullishCoalesce
Nullish coalescing: a ?? b
Await
Await expression (for Promise.all, etc.)
PromiseAll
Promise.all: Promise.all([...])
ApiCall
API call expression (when used inline, not as a statement)
Block
Block expression with local variable bindings and a final result.
Used for arrow function block bodies: x => { const a = x.foo; return a; }
Fields
McpCall
MCP tool call expression: mcp.call('server', 'tool', args)
SdkCall
SDK call expression (used in non-assignment contexts): api.getCostAndUsage({ ... })
BuiltinCall
Built-in function call: parseFloat(x), Math.abs(x), Object.keys(obj)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ValueExpr
impl RefUnwindSafe for ValueExpr
impl Send for ValueExpr
impl Sync for ValueExpr
impl Unpin for ValueExpr
impl UnsafeUnpin for ValueExpr
impl UnwindSafe for ValueExpr
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more