pub struct Scope<P, T> {
pub unsafe_pattern: P,
pub unsafe_body: T,
}
Expand description
A bound scope
Fields
unsafe_pattern: P
The pattern that binds the body of the scope
You can access this directly, but only if you understand what you are
doing! Prefer calling Scope::unbind
instead.
unsafe_body: T
The body of the scope
You can access this directly, but only if you understand what you are
doing! Prefer calling Scope::unbind
instead.
Implementations
sourceimpl<P, T> Scope<P, T>
impl<P, T> Scope<P, T>
sourcepub fn new<N>(pattern: P, body: T) -> Scope<P, T>where
N: Clone + PartialEq,
P: BoundPattern<N>,
T: BoundTerm<N>,
pub fn new<N>(pattern: P, body: T) -> Scope<P, T>where
N: Clone + PartialEq,
P: BoundPattern<N>,
T: BoundTerm<N>,
Create a new scope by binding a term with the given pattern
sourcepub fn unbind<N>(self) -> (P, T)where
N: Clone + Eq + Hash,
P: BoundPattern<N>,
T: BoundTerm<N>,
pub fn unbind<N>(self) -> (P, T)where
N: Clone + Eq + Hash,
P: BoundPattern<N>,
T: BoundTerm<N>,
Unbind a term, returning the freshened pattern and body
sourcepub fn unbind2<N, P2, T2>(self, other: Scope<P2, T2>) -> (P, T, P2, T2)where
N: Clone + Eq + Hash,
P: BoundPattern<N>,
T: BoundTerm<N>,
P2: BoundPattern<N>,
T2: BoundTerm<N>,
pub fn unbind2<N, P2, T2>(self, other: Scope<P2, T2>) -> (P, T, P2, T2)where
N: Clone + Eq + Hash,
P: BoundPattern<N>,
T: BoundTerm<N>,
P2: BoundPattern<N>,
T2: BoundTerm<N>,
Simultaneously unbind two terms
The fresh names in the first pattern with be used for the second pattern
Trait Implementations
sourceimpl<N, P, T> BoundTerm<N> for Scope<P, T>where
N: Clone + PartialEq,
P: BoundPattern<N>,
T: BoundTerm<N>,
impl<N, P, T> BoundTerm<N> for Scope<P, T>where
N: Clone + PartialEq,
P: BoundPattern<N>,
T: BoundTerm<N>,
sourcefn close_term(&mut self, state: ScopeState, on_free: &impl OnFreeFn<N>)
fn close_term(&mut self, state: ScopeState, on_free: &impl OnFreeFn<N>)
Close the term using the supplied binders
sourcefn open_term(&mut self, state: ScopeState, on_bound: &impl OnBoundFn<N>)
fn open_term(&mut self, state: ScopeState, on_bound: &impl OnBoundFn<N>)
Open the term using the supplied binders
sourcefn visit_vars(&self, on_var: &mut impl FnMut(&Var<N>))
fn visit_vars(&self, on_var: &mut impl FnMut(&Var<N>))
Visit each variable in the term, calling the
on_var
callback on each
of them in turn Read moresourcefn visit_mut_vars(&mut self, on_var: &mut impl FnMut(&mut Var<N>))
fn visit_mut_vars(&mut self, on_var: &mut impl FnMut(&mut Var<N>))
Visit each variable in the term, calling the
on_var
callback on each
of them in turn Read moresourceimpl<P: PartialEq, T: PartialEq> PartialEq<Scope<P, T>> for Scope<P, T>
impl<P: PartialEq, T: PartialEq> PartialEq<Scope<P, T>> for Scope<P, T>
impl<P: Eq, T: Eq> Eq for Scope<P, T>
impl<P, T> StructuralEq for Scope<P, T>
impl<P, T> StructuralPartialEq for Scope<P, T>
Auto Trait Implementations
impl<P, T> RefUnwindSafe for Scope<P, T>where
P: RefUnwindSafe,
T: RefUnwindSafe,
impl<P, T> Send for Scope<P, T>where
P: Send,
T: Send,
impl<P, T> Sync for Scope<P, T>where
P: Sync,
T: Sync,
impl<P, T> Unpin for Scope<P, T>where
P: Unpin,
T: Unpin,
impl<P, T> UnwindSafe for Scope<P, T>where
P: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more