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§
Source§impl<P, T> Scope<P, T>
impl<P, T> Scope<P, T>
Sourcepub fn new<N>(pattern: P, body: T) -> Scope<P, T>
pub fn new<N>(pattern: P, body: T) -> Scope<P, T>
Create a new scope by binding a term with the given pattern
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§
Source§impl<N, P, T> BoundTerm<N> for Scope<P, T>
impl<N, P, T> BoundTerm<N> for Scope<P, T>
Source§fn 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
Source§fn 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
Source§fn 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 turnSource§fn 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 turnimpl<P: Eq, T: Eq> Eq for Scope<P, T>
impl<P, T> StructuralPartialEq for Scope<P, T>
Auto Trait Implementations§
impl<P, T> Freeze for Scope<P, T>
impl<P, T> RefUnwindSafe for Scope<P, T>where
P: RefUnwindSafe,
T: RefUnwindSafe,
impl<P, T> Send for Scope<P, T>
impl<P, T> Sync for Scope<P, T>
impl<P, T> Unpin for Scope<P, T>
impl<P, T> UnwindSafe for Scope<P, T>where
P: UnwindSafe,
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more