Skip to main content

SubstWith

Trait SubstWith 

Source
pub trait SubstWith<'db, Term> {
    type Output;

    // Required methods
    fn identity(&self) -> Self::Output;
    fn subst_with<'subst>(
        &'subst self,
        db: &'db dyn Db,
        bound_vars: &mut Vec<SymVariable<'db>>,
        subst_fns: &mut SubstitutionFns<'_, 'db, Term>,
    ) -> Self::Output;
}
Expand description

Core substitution operation: produce a version of this type with variables replaced with instances of Term.

Most types implement this for only a single Term, but not all (see the macro identity_subst).

Required Associated Types§

Source

type Output

The type of the resulting term; typically Self but not always.

Required Methods§

Source

fn identity(&self) -> Self::Output

Reproduce self with no edits.

Source

fn subst_with<'subst>( &'subst self, db: &'db dyn Db, bound_vars: &mut Vec<SymVariable<'db>>, subst_fns: &mut SubstitutionFns<'_, 'db, Term>, ) -> Self::Output

Replace self applying the changes from subst_fns.

§Parameters
  • db, the database
  • start_binder, the index of the binder we started from. This always begins as SymBinderIndex::INNERMOST but gets incremented as we traverse binders.
  • subst_fns, a struct containing callbacks for substitution

Implementations on Foreign Types§

Source§

impl<'db, O, E, Term> SubstWith<'db, Term> for Result<O, E>
where O: SubstWith<'db, Term>, E: SubstWith<'db, Term>,

Source§

type Output = Result<<O as SubstWith<'db, Term>>::Output, <E as SubstWith<'db, Term>>::Output>

Source§

fn identity(&self) -> Self::Output

Source§

fn subst_with<'subst>( &'subst self, db: &'db dyn Db, bound_vars: &mut Vec<SymVariable<'db>>, subst_fns: &mut SubstitutionFns<'_, 'db, Term>, ) -> Self::Output

Source§

impl<'db, T, Term> SubstWith<'db, Term> for &T
where T: SubstWith<'db, Term>,

Source§

type Output = <T as SubstWith<'db, Term>>::Output

Source§

fn subst_with<'subst>( &'subst self, db: &'db dyn Db, bound_vars: &mut Vec<SymVariable<'db>>, subst_fns: &mut SubstitutionFns<'_, 'db, Term>, ) -> Self::Output

Source§

fn identity(&self) -> Self::Output

Source§

impl<'db, T: Subst<'db>> SubstWith<'db, <T as Subst<'db>>::GenericTerm> for Vec<T>

Source§

type Output = Vec<<T as SubstWith<'db, <T as Subst<'db>>::GenericTerm>>::Output>

Source§

fn identity(&self) -> Self::Output

Source§

fn subst_with<'subst>( &'subst self, db: &'db dyn Db, bound_vars: &mut Vec<SymVariable<'db>>, subst_fns: &mut SubstitutionFns<'_, 'db, T::GenericTerm>, ) -> Self::Output

Source§

impl<'db, Term> SubstWith<'db, Term> for PermissionOp

Source§

type Output = PermissionOp

Source§

fn identity(&self) -> Self::Output

Source§

fn subst_with<'subst>( &self, _db: &'db dyn Db, _bound_vars: &mut Vec<SymVariable<'db>>, _subst_fns: &mut SubstitutionFns<'_, 'db, Term>, ) -> Self::Output

Source§

impl<'db, Term> SubstWith<'db, Term> for Never

Source§

type Output = Never

Source§

fn identity(&self) -> Self::Output

Source§

fn subst_with<'subst>( &'subst self, _db: &'db dyn Db, _bound_vars: &mut Vec<SymVariable<'db>>, _subst_fns: &mut SubstitutionFns<'_, 'db, Term>, ) -> Self::Output

Source§

impl<'db, Term> SubstWith<'db, Term> for ()

Source§

type Output = ()

Source§

fn identity(&self) -> Self::Output

Source§

fn subst_with<'subst>( &self, _db: &'db dyn Db, _bound_vars: &mut Vec<SymVariable<'db>>, _subst_fns: &mut SubstitutionFns<'_, 'db, Term>, ) -> Self::Output

Source§

impl<'db, Term> SubstWith<'db, Term> for Reported

Source§

type Output = Reported

Source§

fn identity(&self) -> Self::Output

Source§

fn subst_with<'subst>( &self, _db: &'db dyn Db, _bound_vars: &mut Vec<SymVariable<'db>>, _subst_fns: &mut SubstitutionFns<'_, 'db, Term>, ) -> Self::Output

Source§

impl<'db, Term> SubstWith<'db, Term> for Span<'db>

Source§

type Output = Span<'db>

Source§

fn identity(&self) -> Self::Output

Source§

fn subst_with<'subst>( &self, _db: &'db dyn Db, _bound_vars: &mut Vec<SymVariable<'db>>, _subst_fns: &mut SubstitutionFns<'_, 'db, Term>, ) -> Self::Output

Source§

impl<'db, Term, T> SubstWith<'db, Term> for Option<T>
where T: SubstWith<'db, Term>,

Source§

type Output = Option<<T as SubstWith<'db, Term>>::Output>

Source§

fn identity(&self) -> Self::Output

Source§

fn subst_with<'subst>( &'subst self, db: &'db dyn Db, bound_vars: &mut Vec<SymVariable<'db>>, subst_fns: &mut SubstitutionFns<'_, 'db, Term>, ) -> Self::Output

Implementors§

Source§

impl<'db> SubstWith<'db, SymGenericTerm<'db>> for SymExprKind<'db>

Source§

impl<'db> SubstWith<'db, SymGenericTerm<'db>> for SymPlaceExprKind<'db>

Source§

impl<'db> SubstWith<'db, SymGenericTerm<'db>> for SymGenericTerm<'db>

Source§

impl<'db> SubstWith<'db, SymGenericTerm<'db>> for SymExpr<'db>

Source§

impl<'db> SubstWith<'db, SymGenericTerm<'db>> for SymMatchArm<'db>

Source§

impl<'db> SubstWith<'db, SymGenericTerm<'db>> for SymPlaceExpr<'db>

Source§

impl<'db> SubstWith<'db, SymGenericTerm<'db>> for SymFunctionSignature<'db>

Source§

impl<'db> SubstWith<'db, SymGenericTerm<'db>> for SymInputOutput<'db>

Source§

impl<'db> SubstWith<'db, SymGenericTerm<'db>> for SymWhereClause<'db>

Source§

impl<'db> SubstWith<'db, SymGenericTerm<'db>> for SymPerm<'db>

Source§

impl<'db> SubstWith<'db, SymGenericTerm<'db>> for SymPlace<'db>

Source§

impl<'db> SubstWith<'db, SymGenericTerm<'db>> for SymTy<'db>

Source§

type Output = SymTy<'db>

Source§

impl<'db, T, Term> SubstWith<'db, Term> for NeverBinder<T>

Source§

impl<'db, T: BoundTerm<'db>> SubstWith<'db, <T as Subst<'db>>::GenericTerm> for Binder<'db, T>

Source§

type Output = Binder<'db, T>

Source§

impl<'db, Term> SubstWith<'db, Term> for SymBinaryOp

Source§

impl<'db, Term> SubstWith<'db, Term> for SymLiteral

Source§

impl<'db, Term> SubstWith<'db, Term> for SymWhereClauseKind

Source§

impl<'db, Term> SubstWith<'db, Term> for SymGenericKind

Source§

impl<'db, Term> SubstWith<'db, Term> for SymTyName<'db>

Source§

impl<'db, Term> SubstWith<'db, Term> for SymField<'db>

Source§

impl<'db, Term> SubstWith<'db, Term> for SymByteLiteral<'db>

Source§

impl<'db, Term> SubstWith<'db, Term> for SymFunction<'db>