[][src]Struct chalk_ir::Binders

pub struct Binders<T> {
    pub binders: Vec<ParameterKind<()>>,
    pub value: T,
}

Indicates that the value is universally quantified over N parameters of the given kinds, where N == self.binders.len(). A variable with depth i < N refers to the value at self.binders[i]. Variables with depth >= N are free.

(IOW, we use deBruijn indices, where binders are introduced in reverse order of self.binders.)

Fields

binders: Vec<ParameterKind<()>>value: T

Methods

impl<T> Binders<T>[src]

pub fn map<U, OP>(self, op: OP) -> Binders<U> where
    OP: FnOnce(T) -> U, 
[src]

pub fn map_ref<'a, U, OP>(&'a self, op: OP) -> Binders<U> where
    OP: FnOnce(&'a T) -> U, 
[src]

pub fn with_fresh_type_var<U, TF>(
    self,
    op: impl FnOnce(<T as Fold<TF, TF>>::Result, Ty<TF>) -> U
) -> Binders<U> where
    TF: TypeFamily,
    T: Shift<TF>, 
[src]

Introduces a fresh type variable at the start of the binders and returns new Binders with the result of the operator function applied.

forall<?0, ?1> will become forall<?0, ?1, ?2> where ?0 is the fresh variable

pub fn len(&self) -> usize[src]

impl<T, TF> Binders<T> where
    T: Fold<TF, TF> + HasTypeFamily<TypeFamily = TF>,
    TF: TypeFamily
[src]

pub fn substitute(&self, parameters: &[Parameter<TF>]) -> T::Result[src]

Substitute parameters for the variables introduced by these binders. So if the binders represent (e.g.) <X, Y> { T } and parameters is the slice [A, B], then returns [X => A, Y => B] T.

Trait Implementations

impl<TF: TypeFamily, T: Zip<TF> + Fold<TF, TF, Result = T>> Zip<TF> for Binders<T>[src]

impl<T, TF: TypeFamily, TTF: TypeFamily> Fold<TF, TTF> for Binders<T> where
    T: Fold<TF, TTF>,
    TF: TypeFamily
[src]

type Result = Binders<T::Result>

The type of value that will be produced once folding is done. Typically this is Self, unless Self contains borrowed values, in which case owned values are produced (for example, one can fold over a &T value where T: Fold, in which case you get back a T, not a &T). Read more

impl<T: CastTo<Goal<TF>>, TF: TypeFamily> CastTo<Goal<TF>> for Binders<T>[src]

impl<T, TF> CastTo<ProgramClause<TF>> for Binders<T> where
    T: CastTo<DomainGoal<TF>>,
    TF: TypeFamily
[src]

impl<TF: TypeFamily> CastTo<ProgramClause<TF>> for Binders<ProgramClauseImplication<TF>>[src]

impl<T: HasTypeFamily> HasTypeFamily for Binders<T>[src]

impl<T: Eq> Eq for Binders<T>[src]

impl<T: Clone> Clone for Binders<T>[src]

impl<T: PartialOrd> PartialOrd<Binders<T>> for Binders<T>[src]

impl<T: PartialEq> PartialEq<Binders<T>> for Binders<T>[src]

impl<T: Ord> Ord for Binders<T>[src]

impl<'a, V> IntoIterator for &'a Binders<V> where
    V: HasTypeFamily,
    &'a V: IntoIterator
[src]

Allows iterating over a &Binders<Vec<T>>, for instance. Each element will be a Binders<&T>.

type Item = Binders<<&'a V as IntoIterator>::Item>

The type of the elements being iterated over.

type IntoIter = BindersIntoIterator<&'a V>

Which kind of iterator are we turning this into?

impl<V: IntoIterator> IntoIterator for Binders<V>[src]

Allows iterating over a Binders<Vec>, for instance. Each element will include the same set of parameter bounds.

type Item = Binders<<V as IntoIterator>::Item>

The type of the elements being iterated over.

type IntoIter = BindersIntoIterator<V>

Which kind of iterator are we turning this into?

impl<T: Hash> Hash for Binders<T>[src]

impl<T: Debug> Debug for Binders<T>[src]

Auto Trait Implementations

impl<T> Send for Binders<T> where
    T: Send

impl<T> Unpin for Binders<T> where
    T: Unpin

impl<T> Sync for Binders<T> where
    T: Sync

impl<T> UnwindSafe for Binders<T> where
    T: UnwindSafe

impl<T> RefUnwindSafe for Binders<T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T, TF> Shift<TF> for T where
    T: Fold<TF, TF> + Eq,
    TF: TypeFamily
[src]

impl<T, TF> ReflexiveFold<TF> for T where
    T: Fold<TF, TF, Result = T>,
    TF: TypeFamily
[src]

impl<T> Cast for T[src]

impl<T, TF> CastTo<Goal<TF>> for T where
    T: CastTo<LeafGoal<TF>>,
    TF: TypeFamily
[src]

impl<T, TF> CastTo<ProgramClause<TF>> for T where
    T: CastTo<DomainGoal<TF>>,
    TF: TypeFamily
[src]

impl<T, TF> CouldMatch<T> for T where
    T: Zip<TF> + HasTypeFamily<TypeFamily = TF> + ?Sized,
    TF: TypeFamily
[src]

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

type Owned = T

The resulting type after obtaining ownership.

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

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

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

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.

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

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

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