Skip to main content

Subst

Trait Subst 

Source
pub trait Subst<'db>: SubstWith<'db, Self::GenericTerm> + Debug {
    type GenericTerm: Copy + HasKind<'db> + Debug + FromVar<'db>;

    // Provided methods
    fn subst_vars(
        &self,
        db: &'db dyn Db,
        map: &Map<SymVariable<'db>, Self::GenericTerm>,
    ) -> Self::Output { ... }
    fn subst_var(
        &self,
        db: &'db dyn Db,
        var: SymVariable<'db>,
        term: Self::GenericTerm,
    ) -> Self::Output { ... }
    fn resolve_infer_var(
        &self,
        db: &'db dyn Db,
        bound_vars: &mut Vec<SymVariable<'db>>,
        op: impl FnMut(InferVarIndex) -> Option<Self::GenericTerm>,
    ) -> Self::Output { ... }
}
Expand description

A type implemented by terms that can be substituted.

Required Associated Types§

Source

type GenericTerm: Copy + HasKind<'db> + Debug + FromVar<'db>

The notion of generic term appropriate for this type. When we substitute variables, this is the type of value that we replace them with.

Provided Methods§

Source

fn subst_vars( &self, db: &'db dyn Db, map: &Map<SymVariable<'db>, Self::GenericTerm>, ) -> Self::Output

Returns a version of self where universal free variables have been replaced by the corresponding entry in terms. If a variable is not present in terms it is not substituted.

Source

fn subst_var( &self, db: &'db dyn Db, var: SymVariable<'db>, term: Self::GenericTerm, ) -> Self::Output

Replace the variable var with term.

Source

fn resolve_infer_var( &self, db: &'db dyn Db, bound_vars: &mut Vec<SymVariable<'db>>, op: impl FnMut(InferVarIndex) -> Option<Self::GenericTerm>, ) -> Self::Output

Replace all inference variables with whatever is returned by op; if op returns None, the inference variable is left unchanged.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'db> Subst<'db> for PermissionOp

Source§

impl<'db> Subst<'db> for Never

Source§

impl<'db> Subst<'db> for ()

Source§

impl<'db> Subst<'db> for Reported

Source§

impl<'db> Subst<'db> for Span<'db>

Source§

impl<'db, T> Subst<'db> for &T
where T: Subst<'db>,

Source§

impl<'db, T> Subst<'db> for Vec<T>
where T: Subst<'db>,

Implementors§

Source§

impl<'db> Subst<'db> for SymBinaryOp

Source§

impl<'db> Subst<'db> for SymExprKind<'db>

Source§

impl<'db> Subst<'db> for SymLiteral

Source§

impl<'db> Subst<'db> for SymWhereClauseKind

Source§

impl<'db> Subst<'db> for SymGenericKind

Source§

impl<'db> Subst<'db> for SymGenericTerm<'db>

Source§

impl<'db> Subst<'db> for SymTyName<'db>

Source§

impl<'db> Subst<'db> for SymField<'db>

Source§

impl<'db> Subst<'db> for SymByteLiteral<'db>

Source§

impl<'db> Subst<'db> for SymExpr<'db>

Source§

impl<'db> Subst<'db> for SymMatchArm<'db>

Source§

impl<'db> Subst<'db> for SymPlaceExpr<'db>

Source§

impl<'db> Subst<'db> for SymFunction<'db>

Source§

impl<'db> Subst<'db> for SymFunctionSignature<'db>

Source§

impl<'db> Subst<'db> for SymInputOutput<'db>

Source§

impl<'db> Subst<'db> for SymWhereClause<'db>

Source§

impl<'db> Subst<'db> for SymPerm<'db>

Source§

impl<'db> Subst<'db> for SymPlace<'db>

Source§

impl<'db> Subst<'db> for SymTy<'db>

Source§

impl<'db, T> Subst<'db> for NeverBinder<T>
where T: Debug,

Source§

impl<'db, T: BoundTerm<'db>> Subst<'db> for Binder<'db, T>
where T::Output: BoundTerm<'db>,