Enum bitsy_lang::ast::Expr

source ·
pub enum Expr {
Show 16 variants Ident(Span, Ident), Dot(Span, Box<Expr>, Ident), Word(Span, Option<Width>, u64), Enum(Span, Type, String), Struct(Span, Vec<(String, Box<Expr>)>), Vec(Span, Vec<Expr>), Call(Span, Ident, Vec<TypeParam>, Vec<Expr>), Let(Span, Ident, Option<Type>, Box<Expr>, Box<Expr>), UnOp(Span, UnOp, Box<Expr>), BinOp(Span, BinOp, Box<Expr>, Box<Expr>), If(Span, Box<Expr>, Box<Expr>, Box<Expr>), Match(Span, Box<Expr>, Vec<MatchArm>), IdxField(Span, Box<Expr>, Ident), Idx(Span, Box<Expr>, u64), IdxRange(Span, Box<Expr>, u64, u64), Hole(Span, Option<Ident>),
}
Expand description

An expression.

Variants§

§

Ident(Span, Ident)

A referenec to a port, reg, or node.

§

Dot(Span, Box<Expr>, Ident)

A dotted expression. Eg, foo.bar.

§

Word(Span, Option<Width>, u64)

A literal Word.

§

Enum(Span, Type, String)

A literal enum value.

§

Struct(Span, Vec<(String, Box<Expr>)>)

A constructor for a struct type.

§

Vec(Span, Vec<Expr>)

A constructor for a Vec

§

Call(Span, Ident, Vec<TypeParam>, Vec<Expr>)

A call-like expression, including cat and constructors like @Valid.

§

Let(Span, Ident, Option<Type>, Box<Expr>, Box<Expr>)

Let binding. Eg, let x = a + b in x + x.

§

UnOp(Span, UnOp, Box<Expr>)

A unary operation. Eg, !0b101w3.

§

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

A binary operation. Eg, 1w8 + 1w8.

§

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

An if expression.

§

Match(Span, Box<Expr>, Vec<MatchArm>)

A match expression.

§

IdxField(Span, Box<Expr>, Ident)

A field index. Eg, foo->bar.

§

Idx(Span, Box<Expr>, u64)

A static index. Eg, foo[0].

§

IdxRange(Span, Box<Expr>, u64, u64)

A static index over a range. Eg, foo[8..4].

§

Hole(Span, Option<Ident>)

A hole. Eg, ?foo.

Trait Implementations§

source§

impl Clone for Expr

source§

fn clone(&self) -> Expr

Returns a copy 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

Auto Trait Implementations§

§

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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. 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 Twhere 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.