[][src]Enum ra_ap_hir_def::expr::Expr

pub enum Expr {
    Missing,
    Path(Path),
    If {
        condition: ExprId,
        then_branch: ExprId,
        else_branch: Option<ExprId>,
    },
    Block {
        statements: Vec<Statement>,
        tail: Option<ExprId>,
        label: Option<LabelId>,
    },
    Loop {
        body: ExprId,
        label: Option<LabelId>,
    },
    While {
        condition: ExprId,
        body: ExprId,
        label: Option<LabelId>,
    },
    For {
        iterable: ExprId,
        pat: PatId,
        body: ExprId,
        label: Option<LabelId>,
    },
    Call {
        callee: ExprId,
        args: Vec<ExprId>,
    },
    MethodCall {
        receiver: ExprId,
        method_name: Name,
        args: Vec<ExprId>,
        generic_args: Option<GenericArgs>,
    },
    Match {
        expr: ExprId,
        arms: Vec<MatchArm>,
    },
    Continue {
        label: Option<Name>,
    },
    Break {
        expr: Option<ExprId>,
        label: Option<Name>,
    },
    Return {
        expr: Option<ExprId>,
    },
    RecordLit {
        path: Option<Path>,
        fields: Vec<RecordLitField>,
        spread: Option<ExprId>,
    },
    Field {
        expr: ExprId,
        name: Name,
    },
    Await {
        expr: ExprId,
    },
    Try {
        expr: ExprId,
    },
    TryBlock {
        body: ExprId,
    },
    Async {
        body: ExprId,
    },
    Const {
        body: ExprId,
    },
    Cast {
        expr: ExprId,
        type_ref: TypeRef,
    },
    Ref {
        expr: ExprId,
        rawness: Rawness,
        mutability: Mutability,
    },
    Box {
        expr: ExprId,
    },
    UnaryOp {
        expr: ExprId,
        op: UnaryOp,
    },
    BinaryOp {
        lhs: ExprId,
        rhs: ExprId,
        op: Option<BinaryOp>,
    },
    Range {
        lhs: Option<ExprId>,
        rhs: Option<ExprId>,
        range_type: RangeOp,
    },
    Index {
        base: ExprId,
        index: ExprId,
    },
    Lambda {
        args: Vec<PatId>,
        arg_types: Vec<Option<TypeRef>>,
        ret_type: Option<TypeRef>,
        body: ExprId,
    },
    Tuple {
        exprs: Vec<ExprId>,
    },
    Unsafe {
        body: ExprId,
    },
    Array(Array),
    Literal(Literal),
}

Variants

Missing

This is produced if the syntax tree does not have a required expression piece.

Path(Path)
If

Fields of If

condition: ExprIdthen_branch: ExprIdelse_branch: Option<ExprId>
Block

Fields of Block

statements: Vec<Statement>tail: Option<ExprId>label: Option<LabelId>
Loop

Fields of Loop

body: ExprIdlabel: Option<LabelId>
While

Fields of While

condition: ExprIdbody: ExprIdlabel: Option<LabelId>
For

Fields of For

iterable: ExprIdpat: PatIdbody: ExprIdlabel: Option<LabelId>
Call

Fields of Call

callee: ExprIdargs: Vec<ExprId>
MethodCall

Fields of MethodCall

receiver: ExprIdmethod_name: Nameargs: Vec<ExprId>generic_args: Option<GenericArgs>
Match

Fields of Match

expr: ExprIdarms: Vec<MatchArm>
Continue

Fields of Continue

label: Option<Name>
Break

Fields of Break

expr: Option<ExprId>label: Option<Name>
Return

Fields of Return

expr: Option<ExprId>
RecordLit

Fields of RecordLit

path: Option<Path>fields: Vec<RecordLitField>spread: Option<ExprId>
Field

Fields of Field

expr: ExprIdname: Name
Await

Fields of Await

expr: ExprId
Try

Fields of Try

expr: ExprId
TryBlock

Fields of TryBlock

body: ExprId
Async

Fields of Async

body: ExprId
Const

Fields of Const

body: ExprId
Cast

Fields of Cast

expr: ExprIdtype_ref: TypeRef
Ref

Fields of Ref

expr: ExprIdrawness: Rawnessmutability: Mutability
Box

Fields of Box

expr: ExprId
UnaryOp

Fields of UnaryOp

expr: ExprIdop: UnaryOp
BinaryOp

Fields of BinaryOp

lhs: ExprIdrhs: ExprIdop: Option<BinaryOp>
Range

Fields of Range

lhs: Option<ExprId>rhs: Option<ExprId>range_type: RangeOp
Index

Fields of Index

base: ExprIdindex: ExprId
Lambda

Fields of Lambda

args: Vec<PatId>arg_types: Vec<Option<TypeRef>>ret_type: Option<TypeRef>body: ExprId
Tuple

Fields of Tuple

exprs: Vec<ExprId>
Unsafe

Fields of Unsafe

body: ExprId
Array(Array)
Literal(Literal)

Implementations

impl Expr[src]

pub fn walk_child_exprs(&self, mut f: impl FnMut(ExprId))[src]

Trait Implementations

impl Clone for Expr[src]

impl Debug for Expr[src]

impl Eq for Expr[src]

impl PartialEq<Expr> for Expr[src]

impl StructuralEq for Expr[src]

impl StructuralPartialEq for Expr[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Any for T where
    T: Any
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CloneAny for T where
    T: Clone + Any
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.