Skip to main content

TermKind

Enum TermKind 

Source
pub enum TermKind {
Show 17 variants Int(i64), Char(char), String(String), Float(f64), Identifier(Reference), Fun { param: String, body: Box<Term>, }, Apply { fun: Box<Term>, arg: Box<Term>, saturation: Saturation, }, If { cond: Box<Term>, true_branch: Box<Term>, false_branch: Box<Term>, }, Let { binding: String, value: Box<Term>, body: Box<Term>, }, Tuple(Tuple<Term>), Unit, Case { scrutinee: Box<Term>, branches: Vec<(TermPattern, Box<Term>)>, form: CaseForm, }, Hole, Record(Vec<Field<Term>>), Update { record: Box<Term>, fields: Vec<Field<Term>>, }, Access { record: Box<Term>, label: Name, label_span: NodeSpan, }, Accessor { label: Name, label_span: NodeSpan, },
}

Variants§

§

Int(i64)

An integer literal, at the width Int is (DEC-16). Inference never reads the value — every integer literal is an Int whatever its value — but code generation does.

§

Char(char)

§

String(String)

A string literal’s value, its escape sequences already read.

§

Float(f64)

§

Identifier(Reference)

§

Fun

Fields

§param: String
§body: Box<Term>
§

Apply

Fields

§fun: Box<Term>
§arg: Box<Term>
§saturation: Saturation
§

If

Fields

§cond: Box<Term>
§true_branch: Box<Term>
§false_branch: Box<Term>
§

Let

Fields

§binding: String
§value: Box<Term>
§body: Box<Term>
§

Tuple(Tuple<Term>)

§

Unit

The unit value, ().

§

Case

Fields

§scrutinee: Box<Term>
§branches: Vec<(TermPattern, Box<Term>)>
§form: CaseForm

What the source wrote that this match was built from.

§

Hole

A name that did not resolve, translated from canonical::ExpressionKind::Hole. Inference gives it a fresh type variable and constrains nothing by it, so its type is whatever the node around it requires (DEC-23 decision 6).

§

Record(Vec<Field<Term>>)

A record, its fields in the order they were written. Only its type is a set of fields; the term keeps the order, since fields are evaluated in it.

§

Update

An update: the record updated, and the fields replaced in it in the order they were written.

Fields

§record: Box<Term>
§fields: Vec<Field<Term>>
§

Access

A field access, record.label.

Fields

§record: Box<Term>
§label: Name
§label_span: NodeSpan

Where the label alone was written.

§

Accessor

An accessor, .label: the function reading that field of whichever record it is applied to.

Fields

§label: Name
§label_span: NodeSpan

Where the label alone was written; the term’s own span covers the . too.

Trait Implementations§

Source§

impl Clone for TermKind

Source§

fn clone(&self) -> TermKind

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TermKind

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.