Skip to main content

FSharpExpr

Enum FSharpExpr 

Source
pub enum FSharpExpr {
Show 23 variants Lit(String), Var(String), App(Box<FSharpExpr>, Box<FSharpExpr>), Lambda(String, Box<FSharpExpr>), MultiLambda(Vec<String>, Box<FSharpExpr>), Let(String, Box<FSharpExpr>, Box<FSharpExpr>), LetRec(String, Box<FSharpExpr>, Box<FSharpExpr>), Match(Box<FSharpExpr>, Vec<(FSharpPattern, FSharpExpr)>), If(Box<FSharpExpr>, Box<FSharpExpr>, Box<FSharpExpr>), Tuple(Vec<FSharpExpr>), FsList(Vec<FSharpExpr>), FsArray(Vec<FSharpExpr>), BinOp(String, Box<FSharpExpr>, Box<FSharpExpr>), UnaryOp(String, Box<FSharpExpr>), Record(Vec<(String, FSharpExpr)>), RecordUpdate(Box<FSharpExpr>, Vec<(String, FSharpExpr)>), FieldAccess(Box<FSharpExpr>, String), Seq(Box<FSharpExpr>, Box<FSharpExpr>), Ann(Box<FSharpExpr>, FSharpType), Pipe(Box<FSharpExpr>, Box<FSharpExpr>), Ctor(String, Vec<FSharpExpr>), Do(Vec<FSharpExpr>), Raw(String),
}
Expand description

An F# expression node.

Variants§

§

Lit(String)

Literal source (integer, float, string, bool, unit ())

§

Var(String)

Variable / identifier reference

§

App(Box<FSharpExpr>, Box<FSharpExpr>)

Function application: f x

§

Lambda(String, Box<FSharpExpr>)

Lambda: fun param -> body

§

MultiLambda(Vec<String>, Box<FSharpExpr>)

Multi-parameter lambda: fun a b c -> body

§

Let(String, Box<FSharpExpr>, Box<FSharpExpr>)

Let binding: let name = value in body

§

LetRec(String, Box<FSharpExpr>, Box<FSharpExpr>)

Recursive let binding: let rec name = value in body

§

Match(Box<FSharpExpr>, Vec<(FSharpPattern, FSharpExpr)>)

Pattern match: match expr with | pat -> branch

§

If(Box<FSharpExpr>, Box<FSharpExpr>, Box<FSharpExpr>)

If-then-else

§

Tuple(Vec<FSharpExpr>)

Tuple construction: (a, b, c)

§

FsList(Vec<FSharpExpr>)

List literal: [a; b; c]

§

FsArray(Vec<FSharpExpr>)

Array literal: [| a; b; c |]

§

BinOp(String, Box<FSharpExpr>, Box<FSharpExpr>)

Binary operator: lhs op rhs

§

UnaryOp(String, Box<FSharpExpr>)

Unary operator: op expr

§

Record(Vec<(String, FSharpExpr)>)

Record construction: { field1 = v1; field2 = v2 }

§

RecordUpdate(Box<FSharpExpr>, Vec<(String, FSharpExpr)>)

Record update: { base with field = v }

§

FieldAccess(Box<FSharpExpr>, String)

Field access: expr.Field

§

Seq(Box<FSharpExpr>, Box<FSharpExpr>)

Sequence: expr1; expr2 (semicolon-separated, result is expr2)

§

Ann(Box<FSharpExpr>, FSharpType)

Type annotation: (expr : T)

§

Pipe(Box<FSharpExpr>, Box<FSharpExpr>)

Pipe forward: expr |> f

§

Ctor(String, Vec<FSharpExpr>)

Constructor application: Some x, MyCase(a, b)

§

Do(Vec<FSharpExpr>)

do { ... } computation expression (simplified)

§

Raw(String)

Raw source snippet (escape hatch)

Trait Implementations§

Source§

impl Clone for FSharpExpr

Source§

fn clone(&self) -> FSharpExpr

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 FSharpExpr

Source§

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

Formats the value using the given formatter. Read more

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.