Expression

Enum Expression 

Source
pub enum Expression {
Show 28 variants Identifier(Loc<Path>), IntLiteral(Loc<IntLiteral>), BoolLiteral(Loc<bool>), StrLiteral(Loc<String>), TriLiteral(Loc<BitLiteral>), ArrayLiteral(Vec<Loc<Expression>>), ArrayShorthandLiteral(Box<Loc<Expression>>, Box<Loc<Expression>>), Index(Box<Loc<Expression>>, Box<Loc<Expression>>), RangeIndex { target: Box<Loc<Expression>>, start: Box<Loc<Expression>>, end: Box<Loc<Expression>>, }, Parenthesized(Box<Loc<Expression>>), TupleLiteral(Vec<Loc<Expression>>), TupleIndex(Box<Loc<Expression>>, Loc<u128>), FieldAccess(Box<Loc<Expression>>, Loc<Identifier>), CreatePorts, Lambda { unit_kind: Loc<UnitKind>, args: Loc<Vec<Loc<Pattern>>>, body: Box<Loc<Block>>, }, Call { kind: CallKind, callee: Loc<Path>, args: Loc<ArgumentList>, turbofish: Option<Loc<TurbofishInner>>, }, MethodCall { target: Box<Loc<Expression>>, name: Loc<Identifier>, args: Loc<ArgumentList>, kind: CallKind, turbofish: Option<Loc<TurbofishInner>>, }, If(Box<Loc<Expression>>, Box<Loc<Expression>>, Box<Loc<Expression>>), TypeLevelIf(Box<Loc<Expression>>, Box<Loc<Expression>>, Box<Loc<Expression>>), Match(Box<Loc<Expression>>, Loc<Vec<(Loc<Pattern>, Loc<Expression>)>>), UnaryOperator(Loc<UnaryOperator>, Box<Loc<Expression>>), BinaryOperator(Box<Loc<Expression>>, Loc<BinaryOperator>, Box<Loc<Expression>>), Block(Box<Block>), Unsafe(Box<Loc<Block>>), PipelineReference { stage_kw_and_reference_loc: Loc<()>, stage: PipelineStageReference, name: Loc<Identifier>, }, StageValid, StageReady, StaticUnreachable(Loc<String>),
}

Variants§

§

Identifier(Loc<Path>)

§

IntLiteral(Loc<IntLiteral>)

§

BoolLiteral(Loc<bool>)

§

StrLiteral(Loc<String>)

§

TriLiteral(Loc<BitLiteral>)

§

ArrayLiteral(Vec<Loc<Expression>>)

[1, 2, 3]

§

ArrayShorthandLiteral(Box<Loc<Expression>>, Box<Loc<Expression>>)

[<expr>; <amount>] amount is a const generic

§

Index(Box<Loc<Expression>>, Box<Loc<Expression>>)

§

RangeIndex

Fields

§target: Box<Loc<Expression>>
§

Parenthesized(Box<Loc<Expression>>)

§

TupleLiteral(Vec<Loc<Expression>>)

§

TupleIndex(Box<Loc<Expression>>, Loc<u128>)

§

FieldAccess(Box<Loc<Expression>>, Loc<Identifier>)

§

CreatePorts

§

Lambda

Fields

§unit_kind: Loc<UnitKind>
§args: Loc<Vec<Loc<Pattern>>>
§body: Box<Loc<Block>>
§

Call

Fields

§callee: Loc<Path>
§

MethodCall

§

If(Box<Loc<Expression>>, Box<Loc<Expression>>, Box<Loc<Expression>>)

§

TypeLevelIf(Box<Loc<Expression>>, Box<Loc<Expression>>, Box<Loc<Expression>>)

§

Match(Box<Loc<Expression>>, Loc<Vec<(Loc<Pattern>, Loc<Expression>)>>)

§

UnaryOperator(Loc<UnaryOperator>, Box<Loc<Expression>>)

§

BinaryOperator(Box<Loc<Expression>>, Loc<BinaryOperator>, Box<Loc<Expression>>)

§

Block(Box<Block>)

§

Unsafe(Box<Loc<Block>>)

§

PipelineReference

E.g. stage(-5).x, stage('b).y

Fields

§stage_kw_and_reference_loc: Loc<()>
stage(-5).xyz
^^^^^^^^^
§stage: PipelineStageReference
stage(-5).xyz
      ^^
§name: Loc<Identifier>
stage(-5).xyz
          ^^^
§

StageValid

§

StageReady

§

StaticUnreachable(Loc<String>)

Implementations§

Source§

impl Expression

Source

pub fn int_literal_signed(val: i32) -> Self

Source

pub fn bool_literal(val: bool) -> Self

Source

pub fn as_int_literal(self) -> Option<IntLiteral>

Source

pub fn assume_block(&self) -> &Block

Source

pub fn variant_str(&self) -> &'static str

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.
Source§

impl<T> WithLocation for T

Source§

fn at(self, file_id: usize, span: &impl HasCodespan) -> Loc<Self>
where Self: Sized,

Source§

fn at_loc<T>(self, loc: &Loc<T>) -> Loc<Self>

Creates a new Loc from another Loc
Source§

fn between( self, file_id: usize, start: &impl HasCodespan, end: &impl HasCodespan, ) -> Loc<Self>

Source§

fn between_locs<T, Y>(self, start: &Loc<T>, end: &Loc<Y>) -> Loc<Self>

Source§

fn nowhere(self) -> Loc<Self>
where Self: Sized,