Skip to main content

Statement

Enum Statement 

Source
pub enum Statement {
    Let {
        name: String,
        value: Expression,
        position: Position,
    },
    If {
        condition: Expression,
        then_block: Block,
        else_block: Option<ElseClause>,
        position: Position,
    },
    For {
        init: Option<Box<Statement>>,
        condition: Option<Expression>,
        update: Option<Expression>,
        body: Block,
        position: Position,
    },
    Return {
        value: Option<Expression>,
        position: Position,
    },
    Function {
        name: String,
        params: Vec<String>,
        body: Block,
        position: Position,
    },
    Expression {
        expression: Expression,
        position: Position,
    },
    Block(Block),
}
Expand description

A statement in FiddlerScript.

Variants§

§

Let

Variable declaration: let x = expr;

Fields

§name: String

The variable name being declared

§value: Expression

The initial value expression

§position: Position

Source position of the let keyword

§

If

If statement: if (condition) { ... } else { ... }

Fields

§condition: Expression

The condition expression to evaluate

§then_block: Block

The block to execute if condition is true

§else_block: Option<ElseClause>

Optional else clause (block or else-if)

§position: Position

Source position of the if keyword

§

For

For loop: for (init; condition; update) { ... }

Fields

§init: Option<Box<Statement>>

Optional initialization statement

§condition: Option<Expression>

Optional loop condition expression

§update: Option<Expression>

Optional update expression

§body: Block

The loop body

§position: Position

Source position of the for keyword

§

Return

Return statement: return expr;

Fields

§value: Option<Expression>

Optional return value expression

§position: Position

Source position of the return keyword

§

Function

Function definition: fn name(params) { ... }

Fields

§name: String

The function name

§params: Vec<String>

Parameter names

§body: Block

The function body

§position: Position

Source position of the fn keyword

§

Expression

Expression statement: expr;

Fields

§expression: Expression

The expression to evaluate

§position: Position

Source position of the expression start

§

Block(Block)

Block statement: { ... }

Trait Implementations§

Source§

impl Clone for Statement

Source§

fn clone(&self) -> Statement

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 Statement

Source§

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

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

impl PartialEq for Statement

Source§

fn eq(&self, other: &Statement) -> 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 Statement

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.