1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use binder::Binder;
use bound::{BoundPattern, BoundTerm, OnBoundFn, OnFreeFn, ScopeState};
use var::Var;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Embed<T>(pub T);
impl<N, T> BoundPattern<N> for Embed<T>
where
N: Clone + PartialEq,
T: BoundTerm<N>,
{
fn pattern_eq(&self, other: &Embed<T>) -> bool {
T::term_eq(&self.0, &other.0)
}
fn close_pattern(&mut self, state: ScopeState, on_free: &impl OnFreeFn<N>) {
self.0.close_term(state, on_free);
}
fn open_pattern(&mut self, state: ScopeState, on_bound: &impl OnBoundFn<N>) {
self.0.open_term(state, on_bound);
}
fn visit_vars(&self, on_var: &mut impl FnMut(&Var<N>)) {
self.0.visit_vars(on_var)
}
fn visit_mut_vars(&mut self, on_var: &mut impl FnMut(&mut Var<N>)) {
self.0.visit_mut_vars(on_var)
}
fn visit_binders(&self, _: &mut impl FnMut(&Binder<N>)) {}
fn visit_mut_binders(&mut self, _: &mut impl FnMut(&mut Binder<N>)) {}
}