[−][src]Struct chalk_solve::goal_builder::GoalBuilder
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]
GS: IntoIterator<Item = G>,
G: CastTo<Goal<I>>,
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]
&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>>,
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]
&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>>,
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]
&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>>,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Cast for T
[src]
fn cast<U>(self, interner: &<U as HasInterner>::Interner) -> U where
Self: CastTo<U>,
U: HasInterner,
[src]
Self: CastTo<U>,
U: HasInterner,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,