Skip to main content

Expr

Enum Expr 

Source
pub enum Expr {
Show 39 variants IntLit(i64, Span), FloatLit(f64, Span), StringLit(String, Span), StringInterp(Vec<StringSegment>, Span), BoolLit(bool, Span), NullLit(Span), RawStringLit(String, Span), BytesLit(Vec<u8>, Span), Ident(String, Span), ListLit(Vec<Expr>, Span), MapLit(Vec<(Expr, Expr)>, Span), RecordLit(String, Vec<(String, Expr)>, Span), BinOp(Box<Expr>, BinOp, Box<Expr>, Span), UnaryOp(UnaryOp, Box<Expr>, Span), Call(Box<Expr>, Vec<CallArg>, Span), ToolCall(Box<Expr>, Vec<CallArg>, Span), DotAccess(Box<Expr>, String, Span), IndexAccess(Box<Expr>, Box<Expr>, Span), RoleBlock(String, Box<Expr>, Span), ExpectSchema(Box<Expr>, String, Span), Lambda { params: Vec<Param>, return_type: Option<Box<TypeExpr>>, body: LambdaBody, span: Span, }, TupleLit(Vec<Expr>, Span), SetLit(Vec<Expr>, Span), RangeExpr { start: Option<Box<Expr>>, end: Option<Box<Expr>>, inclusive: bool, step: Option<Box<Expr>>, span: Span, }, TryExpr(Box<Expr>, Span), NullCoalesce(Box<Expr>, Box<Expr>, Span), NullSafeAccess(Box<Expr>, String, Span), NullSafeIndex(Box<Expr>, Box<Expr>, Span), NullAssert(Box<Expr>, Span), SpreadExpr(Box<Expr>, Span), IfExpr { cond: Box<Expr>, then_val: Box<Expr>, else_val: Box<Expr>, span: Span, }, AwaitExpr(Box<Expr>, Span), Comprehension { body: Box<Expr>, var: String, iter: Box<Expr>, condition: Option<Box<Expr>>, kind: ComprehensionKind, span: Span, }, MatchExpr { subject: Box<Expr>, arms: Vec<MatchArm>, span: Span, }, BlockExpr(Vec<Stmt>, Span), Pipe { left: Box<Expr>, right: Box<Expr>, span: Span, }, Illuminate { input: Box<Expr>, transform: Box<Expr>, span: Span, }, IsType { expr: Box<Expr>, type_name: String, span: Span, }, TypeCast { expr: Box<Expr>, target_type: String, span: Span, },
}

Variants§

§

IntLit(i64, Span)

Integer literal

§

FloatLit(f64, Span)

Float literal

§

StringLit(String, Span)

String literal (may contain interpolation)

§

StringInterp(Vec<StringSegment>, Span)

Interpolated string with segments

§

BoolLit(bool, Span)

Boolean literal

§

NullLit(Span)

Null literal

§

RawStringLit(String, Span)

Raw string literal

§

BytesLit(Vec<u8>, Span)

Bytes literal

§

Ident(String, Span)

Variable reference

§

ListLit(Vec<Expr>, Span)

List literal: [a, b, c]

§

MapLit(Vec<(Expr, Expr)>, Span)

Map literal: {“key”: value, …}

§

RecordLit(String, Vec<(String, Expr)>, Span)

Record literal: TypeName(field1: val1, field2: val2)

§

BinOp(Box<Expr>, BinOp, Box<Expr>, Span)

Binary operation

§

UnaryOp(UnaryOp, Box<Expr>, Span)

Unary operation

§

Call(Box<Expr>, Vec<CallArg>, Span)

Function/cell call: name(args)

§

ToolCall(Box<Expr>, Vec<CallArg>, Span)

Tool call with role blocks

§

DotAccess(Box<Expr>, String, Span)

Dot access: expr.field

§

IndexAccess(Box<Expr>, Box<Expr>, Span)

Index access: expr[index]

§

RoleBlock(String, Box<Expr>, Span)

Role block: role system: … end

§

ExpectSchema(Box<Expr>, String, Span)

expect schema Type

§

Lambda

Lambda: fn(params) -> type => expr | fn(params) block end

Fields

§params: Vec<Param>
§return_type: Option<Box<TypeExpr>>
§span: Span
§

TupleLit(Vec<Expr>, Span)

Tuple literal: (a, b, c)

§

SetLit(Vec<Expr>, Span)

Set literal: set[a, b, c]

§

RangeExpr

Range expression: start..end or start..=end

Fields

§start: Option<Box<Expr>>
§inclusive: bool
§step: Option<Box<Expr>>
§span: Span
§

TryExpr(Box<Expr>, Span)

Postfix try: expr?

§

NullCoalesce(Box<Expr>, Box<Expr>, Span)

Null coalescing: lhs ?? rhs

§

NullSafeAccess(Box<Expr>, String, Span)

Null-safe access: expr?.field

§

NullSafeIndex(Box<Expr>, Box<Expr>, Span)

Null-safe index: expr?[index]

§

NullAssert(Box<Expr>, Span)

Null assert: expr!

§

SpreadExpr(Box<Expr>, Span)

Spread: …expr

§

IfExpr

If expression: if cond then a else b

Fields

§cond: Box<Expr>
§then_val: Box<Expr>
§else_val: Box<Expr>
§span: Span
§

AwaitExpr(Box<Expr>, Span)

Await expression: await expr

§

Comprehension

Comprehension: [expr for pat in iter if cond]

Fields

§body: Box<Expr>
§iter: Box<Expr>
§condition: Option<Box<Expr>>
§span: Span
§

MatchExpr

Match expression: match expr … end (expression position)

Fields

§subject: Box<Expr>
§span: Span
§

BlockExpr(Vec<Stmt>, Span)

Block expression: evaluates a sequence of statements, value is last expression

§

Pipe

Pipe operator: x |> f desugars to f(x), x |> f(y) desugars to f(x, y)

Fields

§left: Box<Expr>
§right: Box<Expr>
§span: Span
§

Illuminate

Illuminate operator: data ~> transform calls an AI-capable cell with data as input

Fields

§input: Box<Expr>
§transform: Box<Expr>
§span: Span
§

IsType

Type test: expr is TypeName -> Bool

Fields

§expr: Box<Expr>
§type_name: String
§span: Span
§

TypeCast

Type cast: expr as Type -> converted value

Fields

§expr: Box<Expr>
§target_type: String
§span: Span

Implementations§

Source§

impl Expr

Source

pub fn span(&self) -> Span

Trait Implementations§

Source§

impl Clone for Expr

Source§

fn clone(&self) -> Expr

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 Expr

Source§

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

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

impl<'de> Deserialize<'de> for Expr

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 Serialize for Expr

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

Auto Trait Implementations§

§

impl Freeze for Expr

§

impl RefUnwindSafe for Expr

§

impl Send for Expr

§

impl Sync for Expr

§

impl Unpin for Expr

§

impl UnwindSafe for Expr

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

Source§

type Output = T

Should always be Self
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>,