Enum chalk_solve::solve::Solution
source · [−]pub enum Solution<I: Interner> {
Unique(Canonical<ConstrainedSubst<I>>),
Ambig(Guidance<I>),
}
Expand description
A (possible) solution for a proposed goal.
Variants
Unique(Canonical<ConstrainedSubst<I>>)
The goal indeed holds, and there is a unique value for all existential variables. In this case, we also record a set of lifetime constraints which must also hold for the goal to be valid.
Ambig(Guidance<I>)
The goal may be provable in multiple ways, but regardless we may have some guidance for type inference. In this case, we don’t return any lifetime constraints, since we have not “committed” to any particular solution yet.
Implementations
sourceimpl<I: Interner> Solution<I>
impl<I: Interner> Solution<I>
sourcepub fn combine(self, other: Solution<I>, interner: I) -> Solution<I>
pub fn combine(self, other: Solution<I>, interner: I) -> Solution<I>
There are multiple candidate solutions, which may or may not agree on the values for existential variables; attempt to combine them. This operation does not depend on the order of its arguments.
sourcepub fn into_guidance(self) -> Guidance<I>
pub fn into_guidance(self) -> Guidance<I>
View this solution purely in terms of type inference guidance
sourcepub fn constrained_subst(
&self,
interner: I
) -> Option<Canonical<ConstrainedSubst<I>>>
pub fn constrained_subst(
&self,
interner: I
) -> Option<Canonical<ConstrainedSubst<I>>>
Extract a constrained substitution from this solution, even if ambiguous.
sourcepub fn definite_subst(
&self,
interner: I
) -> Option<Canonical<ConstrainedSubst<I>>>
pub fn definite_subst(
&self,
interner: I
) -> Option<Canonical<ConstrainedSubst<I>>>
Determine whether this solution contains type information that must hold, and returns the subst in that case.
pub fn is_unique(&self) -> bool
pub fn is_ambig(&self) -> bool
pub fn display<'a>(&'a self, interner: I) -> SolutionDisplay<'a, I>
Trait Implementations
sourceimpl<I: Interner> HasInterner for Solution<I>
impl<I: Interner> HasInterner for Solution<I>
type Interner = I
type Interner = I
The interner associated with the type.
impl<I: Eq + Interner> Eq for Solution<I>
impl<I: Interner> StructuralEq for Solution<I>
impl<I: Interner> StructuralPartialEq for Solution<I>
Auto Trait Implementations
impl<I> RefUnwindSafe for Solution<I> where
<I as Interner>::InternedCanonicalVarKinds: RefUnwindSafe,
<I as Interner>::InternedConstraints: RefUnwindSafe,
<I as Interner>::InternedSubstitution: RefUnwindSafe,
impl<I> Send for Solution<I> where
<I as Interner>::InternedCanonicalVarKinds: Send,
<I as Interner>::InternedConstraints: Send,
<I as Interner>::InternedSubstitution: Send,
impl<I> Sync for Solution<I> where
<I as Interner>::InternedCanonicalVarKinds: Sync,
<I as Interner>::InternedConstraints: Sync,
<I as Interner>::InternedSubstitution: Sync,
impl<I> Unpin for Solution<I> where
<I as Interner>::InternedCanonicalVarKinds: Unpin,
<I as Interner>::InternedConstraints: Unpin,
<I as Interner>::InternedSubstitution: Unpin,
impl<I> UnwindSafe for Solution<I> where
<I as Interner>::InternedCanonicalVarKinds: UnwindSafe,
<I as Interner>::InternedConstraints: UnwindSafe,
<I as Interner>::InternedSubstitution: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Cast for T
impl<T> Cast for T
sourcefn cast<U>(self, interner: <U as HasInterner>::Interner) -> U where
Self: CastTo<U>,
U: HasInterner,
fn cast<U>(self, interner: <U as HasInterner>::Interner) -> U where
Self: CastTo<U>,
U: HasInterner,
Cast a value to type U
using CastTo
.
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcepub fn equivalent(&self, key: &K) -> bool
pub fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more