Skip to main content

Expression

Enum Expression 

Source
pub enum Expression {
Show 14 variants Integer { value: i64, position: Position, }, Float { value: f64, position: Position, }, String { value: String, position: Position, }, Boolean { value: bool, position: Position, }, Null { position: Position, }, Identifier { name: String, position: Position, }, Binary { left: Box<Expression>, operator: BinaryOp, right: Box<Expression>, position: Position, }, Unary { operator: UnaryOp, operand: Box<Expression>, position: Position, }, Assignment { name: String, value: Box<Expression>, position: Position, }, Call { function: String, arguments: Vec<Expression>, position: Position, }, MethodCall { receiver: Box<Expression>, method: String, arguments: Vec<Expression>, position: Position, }, Grouped { expression: Box<Expression>, position: Position, }, ArrayLiteral { elements: Vec<Expression>, position: Position, }, DictionaryLiteral { pairs: Vec<(Expression, Expression)>, position: Position, },
}
Expand description

An expression in FiddlerScript.

Variants§

§

Integer

Integer literal: 42

Fields

§value: i64

The integer value

§position: Position

Source position

§

Float

Float literal: 3.14

Fields

§value: f64

The float value

§position: Position

Source position

§

String

String literal: "hello"

Fields

§value: String

The string value

§position: Position

Source position

§

Boolean

Boolean literal: true or false

Fields

§value: bool

The boolean value

§position: Position

Source position

§

Null

Null literal: null

Fields

§position: Position

Source position

§

Identifier

Variable reference: x

Fields

§name: String

The variable name

§position: Position

Source position

§

Binary

Binary operation: a + b

Fields

§left: Box<Expression>

Left operand

§operator: BinaryOp

The binary operator

§right: Box<Expression>

Right operand

§position: Position

Source position

§

Unary

Unary operation: -x or !x

Fields

§operator: UnaryOp

The unary operator

§operand: Box<Expression>

The operand expression

§position: Position

Source position

§

Assignment

Assignment: x = value

Fields

§name: String

The variable name being assigned

§value: Box<Expression>

The value expression

§position: Position

Source position

§

Call

Function call: foo(args)

Fields

§function: String

The function name

§arguments: Vec<Expression>

The argument expressions

§position: Position

Source position

§

MethodCall

Method call: expr.method(args)

Fields

§receiver: Box<Expression>

The receiver expression (object the method is called on)

§method: String

The method name

§arguments: Vec<Expression>

The argument expressions

§position: Position

Source position

§

Grouped

Grouped expression: (expr)

Fields

§expression: Box<Expression>

The inner expression

§position: Position

Source position

§

ArrayLiteral

Array literal: [1, 2, 3]

Fields

§elements: Vec<Expression>

The array element expressions

§position: Position

Source position

§

DictionaryLiteral

Dictionary literal: {"key": value, "another": 42}

Fields

§pairs: Vec<(Expression, Expression)>

Key-value pairs where keys are string expressions

§position: Position

Source position

Implementations§

Source§

impl Expression

Source

pub fn position(&self) -> Position

Get the position of this expression.

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