Skip to main content

Expr

Enum Expr 

Source
pub enum Expr {
Show 41 variants Ident(Ident), StringLiteral(StringLiteral), BacktickLiteral { span: Span, value: String, }, NumberLiteral { span: Span, value: String, }, BoolLiteral { span: Span, value: bool, }, Null { span: Span, }, Now { span: Span, }, This { span: Span, }, Within { span: Span, }, DurationLiteral { span: Span, value: String, }, SetLiteral { span: Span, elements: Vec<Expr>, }, ObjectLiteral { span: Span, fields: Vec<NamedArg>, }, GenericType { span: Span, name: Box<Expr>, args: Vec<Expr>, }, MemberAccess { span: Span, object: Box<Expr>, field: Ident, }, OptionalAccess { span: Span, object: Box<Expr>, field: Ident, }, NullCoalesce { span: Span, left: Box<Expr>, right: Box<Expr>, }, Call { span: Span, function: Box<Expr>, args: Vec<CallArg>, }, JoinLookup { span: Span, entity: Box<Expr>, fields: Vec<JoinField>, }, BinaryOp { span: Span, left: Box<Expr>, op: BinaryOp, right: Box<Expr>, }, Comparison { span: Span, left: Box<Expr>, op: ComparisonOp, right: Box<Expr>, }, LogicalOp { span: Span, left: Box<Expr>, op: LogicalOp, right: Box<Expr>, }, Not { span: Span, operand: Box<Expr>, }, In { span: Span, element: Box<Expr>, collection: Box<Expr>, }, NotIn { span: Span, element: Box<Expr>, collection: Box<Expr>, }, Exists { span: Span, operand: Box<Expr>, }, NotExists { span: Span, operand: Box<Expr>, }, Where { span: Span, source: Box<Expr>, condition: Box<Expr>, }, With { span: Span, source: Box<Expr>, predicate: Box<Expr>, }, Pipe { span: Span, left: Box<Expr>, right: Box<Expr>, }, Lambda { span: Span, param: Box<Expr>, body: Box<Expr>, }, Conditional { span: Span, branches: Vec<CondBranch>, else_body: Option<Box<Expr>>, }, For { span: Span, binding: ForBinding, collection: Box<Expr>, filter: Option<Box<Expr>>, body: Box<Expr>, }, ProjectionMap { span: Span, source: Box<Expr>, field: Ident, }, TransitionsTo { span: Span, subject: Box<Expr>, new_state: Box<Expr>, }, Becomes { span: Span, subject: Box<Expr>, new_state: Box<Expr>, }, Binding { span: Span, name: Ident, value: Box<Expr>, }, WhenGuard { span: Span, action: Box<Expr>, condition: Box<Expr>, }, TypeOptional { span: Span, inner: Box<Expr>, }, LetExpr { span: Span, name: Ident, value: Box<Expr>, }, QualifiedName(QualifiedName), Block { span: Span, items: Vec<Expr>, },
}

Variants§

§

Ident(Ident)

identifier or _

§

StringLiteral(StringLiteral)

"text" possibly with {interpolation}

§

BacktickLiteral

`de-CH-1996` — backtick-quoted enum literal

Fields

§span: Span
§value: String
§

NumberLiteral

42, 100_000, 3.14

Fields

§span: Span
§value: String
§

BoolLiteral

true, false

Fields

§span: Span
§value: bool
§

Null

null

Fields

§span: Span
§

Now

now

Fields

§span: Span
§

This

this

Fields

§span: Span
§

Within

within

Fields

§span: Span
§

DurationLiteral

24.hours, 7.days

Fields

§span: Span
§value: String
§

SetLiteral

{ a, b, c } — set literal

Fields

§span: Span
§elements: Vec<Expr>
§

ObjectLiteral

{ key: value, ... } — object literal

Fields

§span: Span
§fields: Vec<NamedArg>
§

GenericType

Set<T>, List<T> — generic type annotation

Fields

§span: Span
§name: Box<Expr>
§args: Vec<Expr>
§

MemberAccess

a.b

Fields

§span: Span
§object: Box<Expr>
§field: Ident
§

OptionalAccess

a?.b

Fields

§span: Span
§object: Box<Expr>
§field: Ident
§

NullCoalesce

a ?? b

Fields

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

Call

func(args) or entity.method(args)

Fields

§span: Span
§function: Box<Expr>
§args: Vec<CallArg>
§

JoinLookup

Entity{field1, field2} or Entity{field: value}

Fields

§span: Span
§entity: Box<Expr>
§fields: Vec<JoinField>
§

BinaryOp

a + b, a - b, a * b, a / b

Fields

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

Comparison

a = b, a != b, a < b, a <= b, a > b, a >= b

Fields

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

LogicalOp

a and b, a or b

Fields

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

Not

not expr

Fields

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

In

x in collection

Fields

§span: Span
§element: Box<Expr>
§collection: Box<Expr>
§

NotIn

x not in collection

Fields

§span: Span
§element: Box<Expr>
§collection: Box<Expr>
§

Exists

exists expr

Fields

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

NotExists

not exists expr

Fields

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

Where

collection where condition

Fields

§span: Span
§source: Box<Expr>
§condition: Box<Expr>
§

With

collection with predicate (in relationship declarations)

Fields

§span: Span
§source: Box<Expr>
§predicate: Box<Expr>
§

Pipe

a | b — pipe, used for inline enums and sum type discriminators

Fields

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

Lambda

x => body

Fields

§span: Span
§param: Box<Expr>
§body: Box<Expr>
§

Conditional

if cond: a else if cond: b else: c

Fields

§span: Span
§branches: Vec<CondBranch>
§else_body: Option<Box<Expr>>
§

For

for x in collection [where cond]: body

Fields

§span: Span
§binding: ForBinding
§collection: Box<Expr>
§filter: Option<Box<Expr>>
§body: Box<Expr>
§

ProjectionMap

collection where cond -> field — projection mapping

Fields

§span: Span
§source: Box<Expr>
§field: Ident
§

TransitionsTo

Entity.status transitions_to state

Fields

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

Becomes

Entity.status becomes state

Fields

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

Binding

name: expr — binding inside a clause value (when triggers, facing, context)

Fields

§span: Span
§name: Ident
§value: Box<Expr>
§

WhenGuard

action when condition — guard on a provides/related item

Fields

§span: Span
§action: Box<Expr>
§condition: Box<Expr>
§

TypeOptional

T? — optional type annotation

Fields

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

LetExpr

let name = value inside an expression block (ensures, provides, etc.)

Fields

§span: Span
§name: Ident
§value: Box<Expr>
§

QualifiedName(QualifiedName)

oauth/Session — qualified name with module prefix

§

Block

A sequence of expressions from a multi-line block.

Fields

§span: Span
§items: Vec<Expr>

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 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 UnsafeUnpin 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> 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.