Enum Expr

Source
pub enum Expr<'a, 'f> {
    Const(ConstValue),
    Ident(Ident<'a, 'f>),
    Unary(Spanned<'f, UnaryOp>, Spanned<'f, Box<Expr<'a, 'f>>>),
    Binary(Spanned<'f, BinaryOp>, Spanned<'f, Box<Expr<'a, 'f>>>, Spanned<'f, Box<Expr<'a, 'f>>>),
    NAry(NAryOp, Spanned<'f, Vec<Spanned<'f, Expr<'a, 'f>>>>),
    Slice(Spanned<'f, Box<Expr<'a, 'f>>>, Spanned<'f, Box<Expr<'a, 'f>>>, Spanned<'f, Box<Expr<'a, 'f>>>, Option<Spanned<'f, Box<Expr<'a, 'f>>>>),
    Ternary {
        op: TernaryOp,
        condition: Spanned<'f, Box<Expr<'a, 'f>>>,
        then: Spanned<'f, Box<Expr<'a, 'f>>>,
        otherwise: Spanned<'f, Box<Expr<'a, 'f>>>,
    },
    NamedClock(Spanned<'f, ClockExpr<'a, 'f>>),
    CallByName(Spanned<'f, Ident<'a, 'f>>, Vec<Spanned<'f, StaticArg<'a, 'f>>>, Vec<Spanned<'f, Expr<'a, 'f>>>),
    CreateStruct {
        ty_name: Spanned<'f, Ident<'a, 'f>>,
        fields: Vec<(Spanned<'f, Ident<'a, 'f>>, Spanned<'f, Expr<'a, 'f>>)>,
        base_value: Option<Spanned<'f, Box<Expr<'a, 'f>>>>,
    },
    Merge(Spanned<'f, Ident<'a, 'f>>, Vec<Spanned<'f, MergeCase<'a, 'f>>>),
    CallByPos(Spanned<'f, (Spanned<'f, Ident<'a, 'f>>, Vec<StaticArg<'a, 'f>>)>, Vec<Spanned<'f, Expr<'a, 'f>>>),
}
Expand description

An expression

Variants§

§

Const(ConstValue)

Constant value

§

Ident(Ident<'a, 'f>)

Identifier

§

Unary(Spanned<'f, UnaryOp>, Spanned<'f, Box<Expr<'a, 'f>>>)

Unary operation

Tuple Fields

§0: Spanned<'f, UnaryOp>

Operator

§1: Spanned<'f, Box<Expr<'a, 'f>>>

Operand

§

Binary(Spanned<'f, BinaryOp>, Spanned<'f, Box<Expr<'a, 'f>>>, Spanned<'f, Box<Expr<'a, 'f>>>)

Binary operation

Tuple Fields

§0: Spanned<'f, BinaryOp>

Operator

§1: Spanned<'f, Box<Expr<'a, 'f>>>

LHS

§2: Spanned<'f, Box<Expr<'a, 'f>>>

RHS

§

NAry(NAryOp, Spanned<'f, Vec<Spanned<'f, Expr<'a, 'f>>>>)

N-ary operation

Tuple Fields

§0: NAryOp

Operator

§1: Spanned<'f, Vec<Spanned<'f, Expr<'a, 'f>>>>

Operands

§

Slice(Spanned<'f, Box<Expr<'a, 'f>>>, Spanned<'f, Box<Expr<'a, 'f>>>, Spanned<'f, Box<Expr<'a, 'f>>>, Option<Spanned<'f, Box<Expr<'a, 'f>>>>)

Slice access (tab[x..y])

Tuple Fields

§0: Spanned<'f, Box<Expr<'a, 'f>>>

Array

§1: Spanned<'f, Box<Expr<'a, 'f>>>

Start

§2: Spanned<'f, Box<Expr<'a, 'f>>>

End

§3: Option<Spanned<'f, Box<Expr<'a, 'f>>>>

Step

§

Ternary

Ternary expression

Fields

§op: TernaryOp

Operator

§condition: Spanned<'f, Box<Expr<'a, 'f>>>

Condition

§then: Spanned<'f, Box<Expr<'a, 'f>>>

Value if the condition is true

§otherwise: Spanned<'f, Box<Expr<'a, 'f>>>

Value if the condition is false

§

NamedClock(Spanned<'f, ClockExpr<'a, 'f>>)

A clock expression

§

CallByName(Spanned<'f, Ident<'a, 'f>>, Vec<Spanned<'f, StaticArg<'a, 'f>>>, Vec<Spanned<'f, Expr<'a, 'f>>>)

Node call

Not sure what the difference with Expr::CallByPos is… TODO

Tuple Fields

§0: Spanned<'f, Ident<'a, 'f>>

The name of the node

§1: Vec<Spanned<'f, StaticArg<'a, 'f>>>

The static arguments

§2: Vec<Spanned<'f, Expr<'a, 'f>>>

The dynamic arguments

§

CreateStruct

Structure creation

Fields

§ty_name: Spanned<'f, Ident<'a, 'f>>

Type name

§fields: Vec<(Spanned<'f, Ident<'a, 'f>>, Spanned<'f, Expr<'a, 'f>>)>

Fields (name and value)

§base_value: Option<Spanned<'f, Box<Expr<'a, 'f>>>>

Base structure (fields that are not specified will be copied from this structure)

§

Merge(Spanned<'f, Ident<'a, 'f>>, Vec<Spanned<'f, MergeCase<'a, 'f>>>)

Merge operation

Tuple Fields

§0: Spanned<'f, Ident<'a, 'f>>

Not sure what that is TODO

§1: Vec<Spanned<'f, MergeCase<'a, 'f>>>

The different cases of the merge

§

CallByPos(Spanned<'f, (Spanned<'f, Ident<'a, 'f>>, Vec<StaticArg<'a, 'f>>)>, Vec<Spanned<'f, Expr<'a, 'f>>>)

Node call

Not sure what the difference with Expr::CallByName is… TODO

Tuple Fields

§0: Spanned<'f, (Spanned<'f, Ident<'a, 'f>>, Vec<StaticArg<'a, 'f>>)>

The node name and its static arguments

TODO: shouldn’t that be two different fields?

§1: Vec<Spanned<'f, Expr<'a, 'f>>>

The dynamic arguments

Trait Implementations§

Source§

impl<'a, 'f> Clone for Expr<'a, 'f>

Source§

fn clone(&self) -> Expr<'a, 'f>

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<'a, 'f> Debug for Expr<'a, 'f>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, 'f> Freeze for Expr<'a, 'f>

§

impl<'a, 'f> RefUnwindSafe for Expr<'a, 'f>

§

impl<'a, 'f> Send for Expr<'a, 'f>

§

impl<'a, 'f> Sync for Expr<'a, 'f>

§

impl<'a, 'f> Unpin for Expr<'a, 'f>

§

impl<'a, 'f> UnwindSafe for Expr<'a, 'f>

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.