pub enum Binding {
    ConstInt {
        val: i128,
        ty: TypeId,
    },
    ConstPrim {
        val: Sym,
    },
    Argument {
        index: TupleIndex,
    },
    Extractor {
        term: TermId,
        parameter: BindingId,
    },
    Constructor {
        term: TermId,
        parameters: Box<[BindingId]>,
        instance: u32,
    },
    Iterator {
        source: BindingId,
    },
    MakeVariant {
        ty: TypeId,
        variant: VariantId,
        fields: Box<[BindingId]>,
    },
    MatchVariant {
        source: BindingId,
        variant: VariantId,
        field: TupleIndex,
    },
    MatchSome {
        source: BindingId,
    },
    MatchTuple {
        source: BindingId,
        field: TupleIndex,
    },
}
Expand description

Bindings are anything which can be bound to a variable name in Rust. This includes expressions, such as constants or function calls; but it also includes names bound in pattern matches.

Variants§

§

ConstInt

Fields

§val: i128

The constant value.

§ty: TypeId

The constant’s type. Unsigned types preserve the representation of val, not its value.

Evaluates to the given integer literal.

§

ConstPrim

Fields

§val: Sym

The constant value.

Evaluates to the given primitive Rust value.

§

Argument

Fields

§index: TupleIndex

Which of the function’s arguments is this?

One of the arguments to the top-level function.

§

Extractor

Fields

§term: TermId

Which extractor should be called?

§parameter: BindingId

What expression should be passed to the extractor?

The result of calling an external extractor.

§

Constructor

Fields

§term: TermId

Which constructor should be called?

§parameters: Box<[BindingId]>

What expressions should be passed to the constructor?

§instance: u32

For impure constructors, a unique number for each use of this term. Always 0 for pure constructors.

The result of calling an external constructor.

§

Iterator

Fields

§source: BindingId

Which expression produced the iterator that this consumes?

The result of getting one value from a multi-constructor or multi-extractor.

§

MakeVariant

Fields

§ty: TypeId

Which enum type should be constructed?

§variant: VariantId

Which variant of that enum should be constructed?

§fields: Box<[BindingId]>

What expressions should be provided for this variant’s fields?

The result of constructing an enum variant.

§

MatchVariant

Fields

§source: BindingId

Which binding is being matched?

§variant: VariantId

Which enum variant are we pulling binding sites from? This is somewhat redundant with information in a corresponding Constraint. However, it must be here so that different enum variants aren’t hash-consed into the same binding site.

§field: TupleIndex

Which field of this enum variant are we projecting out? Although ISLE uses named fields, we track them by index for constant-time comparisons. The sema::TypeEnv can be used to get the field names.

Pattern-match one of the previous bindings against an enum variant and produce a new binding from one of its fields. There must be a corresponding Constraint::Variant for each source/variant pair that appears in some MatchVariant binding.

§

MatchSome

Fields

§source: BindingId

Which binding is being matched?

Pattern-match one of the previous bindings against Option::Some and produce a new binding from its contents. There must be a corresponding Constraint::Some for each source that appears in a MatchSome binding. (This currently only happens with external extractors.)

§

MatchTuple

Fields

§source: BindingId

Which binding is being matched?

§field: TupleIndex

Which tuple field are we projecting out?

Pattern-match one of the previous bindings against a tuple and produce a new binding from one of its fields. This is an irrefutable pattern match so there is no corresponding Constraint. (This currently only happens with external extractors.)

Implementations§

source§

impl Binding

source

pub fn sources(&self) -> &[BindingId]

Returns the binding sites which must be evaluated before this binding.

Trait Implementations§

source§

impl Clone for Binding

source§

fn clone(&self) -> Binding

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 Binding

source§

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

Formats the value using the given formatter. Read more
source§

impl Hash for Binding

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq<Binding> for Binding

source§

fn eq(&self, other: &Binding) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Binding

source§

impl StructuralEq for Binding

source§

impl StructuralPartialEq for Binding

Auto Trait Implementations§

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,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · 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.
const: unstable · 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.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.