pub trait PredicateProxy<I: Interner>:
TypeSuperFoldable<I>
+ TypeSuperVisitable<I>
+ Flags
+ Copy {
// Required methods
fn allow_normalization(&self) -> bool;
fn clause_kind_unchecked(&self) -> Option<Binder<I, ClauseKind<I>>>;
fn map_projection(
self,
cx: I,
f: impl FnOnce(Binder<I, ProjectionClause<I>>) -> Binder<I, ProjectionClause<I>>,
) -> Option<Self>;
}Expand description
Fold predicate deliberately doesn’t get access
to an actual predicate. This way, we can compress lists of predicates, and hide
this detail to folders. Instead, some type implementing this trait, PredicateProxy
is passed, with its limited API.
Most TypeFolders only use fold_predicate to inspect type flags.
Required Methods§
fn allow_normalization(&self) -> bool
Sourcefn clause_kind_unchecked(&self) -> Option<Binder<I, ClauseKind<I>>>
fn clause_kind_unchecked(&self) -> Option<Binder<I, ClauseKind<I>>>
Gets the underlying clause kind (if this predicate is a clause, otherwise None).
The fact that it’s unchecked, is because no attempt is made to hide implementation
details. For example, in the future we may compress clauses together. Code calling
clause_kind_unchecked will have to correctly deal with these implementation details,
and have code handling any edgecase arising as a result.
Sourcefn map_projection(
self,
cx: I,
f: impl FnOnce(Binder<I, ProjectionClause<I>>) -> Binder<I, ProjectionClause<I>>,
) -> Option<Self>
fn map_projection( self, cx: I, f: impl FnOnce(Binder<I, ProjectionClause<I>>) -> Binder<I, ProjectionClause<I>>, ) -> Option<Self>
If self is a projection clause, call f with it. The result will be rebound and returned as Some.
Otherwise, when self is not a projection clause, None is returned.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".