[][src]Struct chalk_solve::goal_builder::GoalBuilder

pub struct GoalBuilder<'i, I: Interner> { /* fields omitted */ }

Implementations

impl<'i, I: Interner> GoalBuilder<'i, I>[src]

pub fn new(db: &'i dyn RustIrDatabase<I>) -> Self[src]

pub fn db(&self) -> &'i dyn RustIrDatabase<I>[src]

Returns the database within the goal builder.

pub fn interner(&self) -> &'i I[src]

Returns the interner within the goal builder.

pub fn all<GS, G>(&mut self, goals: GS) -> Goal<I> where
    GS: IntoIterator<Item = G>,
    G: CastTo<Goal<I>>, 
[src]

Creates a goal that ensures all of the goals from the goals iterator are met (e.g., goals[0] && ... && goals[N]).

pub fn implies<CS, C, G>(
    &mut self,
    clauses: CS,
    goal: impl FnOnce(&mut Self) -> G
) -> Goal<I> where
    CS: IntoIterator<Item = C>,
    C: CastTo<ProgramClause<I>>,
    G: CastTo<Goal<I>>, 
[src]

Creates a goal clauses => goal. The clauses are given as an iterator and the goal is returned via the contained closure.

pub fn forall<G, B, P>(
    &mut self,
    binders: &Binders<B>,
    passthru: P,
    body: fn(_: &mut Self, _: Substitution<I>, _: &B, _: P::Result) -> G
) -> Goal<I> where
    B: Fold<I> + HasInterner<Interner = I>,
    P: Fold<I>,
    B::Result: Debug,
    G: CastTo<Goal<I>>, 
[src]

Given a bound value binders like <P0..Pn> V, creates a goal forall<Q0..Qn> { G } where the goal G is created by invoking a helper function body.

Parameters to body

body will be invoked with:

  • the goal builder self
  • the substitution Q0..Qn
  • the bound value [P0..Pn => Q0..Qn] V instantiated with the substitution
  • the value passthru, appropriately shifted so that any debruijn indices within account for the new binder

Why is body a function and not a closure?

This is to ensure that body doesn't accidentally reference values from the environment whose debruijn indices do not account for the new binder being created.

pub fn exists<G, B, P>(
    &mut self,
    binders: &Binders<B>,
    passthru: P,
    body: fn(_: &mut Self, _: Substitution<I>, _: &B, _: P::Result) -> G
) -> Goal<I> where
    B: Fold<I> + HasInterner<Interner = I>,
    P: Fold<I>,
    B::Result: Debug,
    G: CastTo<Goal<I>>, 
[src]

Like GoalBuilder::forall, but for a exists<Q0..Qn> { G } goal.

Auto Trait Implementations

impl<'i, I> !RefUnwindSafe for GoalBuilder<'i, I>

impl<'i, I> !Send for GoalBuilder<'i, I>

impl<'i, I> !Sync for GoalBuilder<'i, I>

impl<'i, I> Unpin for GoalBuilder<'i, I>

impl<'i, I> !UnwindSafe for GoalBuilder<'i, I>

Blanket Implementations

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

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

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

impl<T> Cast for T[src]

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

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<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.