#[repr(transparent)]pub struct BinderSlice<T>([T]);Expand description
A borrowed portion of a BindingStack.
Tuple Fields§
§0: [T]Implementations§
Source§impl<T> BinderSlice<T>
impl<T> BinderSlice<T>
fn from_slice(stack: &[T]) -> &Self
fn from_slice_mut(stack: &mut [T]) -> &mut Self
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
pub fn depth(&self) -> DeBruijnId
Sourcepub fn as_bound_var<Id>(&self, var: DeBruijnVar<Id>) -> (DeBruijnId, Id)
pub fn as_bound_var<Id>(&self, var: DeBruijnVar<Id>) -> (DeBruijnId, Id)
Map a bound variable to its binding depth. Panics on free variables.
Sourcepub fn as_bound_var_with_outermost_free<Id>(
&self,
var: DeBruijnVar<Id>,
) -> (DeBruijnId, Id)
pub fn as_bound_var_with_outermost_free<Id>( &self, var: DeBruijnVar<Id>, ) -> (DeBruijnId, Id)
Map a bound variable to its binding depth. Considers free variables to be bound at the
outermost binder, like when --unbind-item-vars is set.
Sourcefn real_index(&self, id: DeBruijnId) -> Option<usize>
fn real_index(&self, id: DeBruijnId) -> Option<usize>
Helper that computes the real index into the underlying slice.
pub fn get(&self, id: DeBruijnId) -> Option<&T>
Sourcepub fn get_var<Id: TypeLevelVar>(
&self,
var: DeBruijnVar<Id>,
) -> Option<&Id::Param>where
T: Borrow<GenericParams>,
pub fn get_var<Id: TypeLevelVar>(
&self,
var: DeBruijnVar<Id>,
) -> Option<&Id::Param>where
T: Borrow<GenericParams>,
Lookup this variable in the stack. Panics on free variables.
pub fn get_var_and_shift<'a, Id: TypeLevelVar, R>( &'a self, var: DeBruijnVar<Id>, f: impl FnOnce(&'a Id::Param) -> R, ) -> Option<R>
pub fn get_var_with_outermost_free<Id: TypeLevelVar>(
&self,
var: DeBruijnVar<Id>,
) -> Option<&Id::Param>where
T: Borrow<GenericParams>,
pub fn get_mut(&mut self, id: DeBruijnId) -> Option<&mut T>
Sourcepub fn iter(&self) -> impl DoubleEndedIterator<Item = &T> + ExactSizeIterator
pub fn iter(&self) -> impl DoubleEndedIterator<Item = &T> + ExactSizeIterator
Iterate over the binding levels, from the innermost (0) out.
Sourcepub fn iter_mut(
&mut self,
) -> impl DoubleEndedIterator<Item = &mut T> + ExactSizeIterator
pub fn iter_mut( &mut self, ) -> impl DoubleEndedIterator<Item = &mut T> + ExactSizeIterator
Iterate mutably over the binding levels, from the innermost (0) out.
Sourcepub fn indices(
&self,
) -> impl DoubleEndedIterator<Item = DeBruijnId> + ExactSizeIterator + use<T>
pub fn indices( &self, ) -> impl DoubleEndedIterator<Item = DeBruijnId> + ExactSizeIterator + use<T>
Iterate over the binding levels, from the innermost (0) out.
Sourcepub fn iter_enumerated(
&self,
) -> impl DoubleEndedIterator<Item = (DeBruijnId, &T)> + ExactSizeIterator
pub fn iter_enumerated( &self, ) -> impl DoubleEndedIterator<Item = (DeBruijnId, &T)> + ExactSizeIterator
Iterate over the binding levels, from the innermost (0) out.
Sourcepub fn iter_mut_enumerated(
&mut self,
) -> impl DoubleEndedIterator<Item = (DeBruijnId, &mut T)> + ExactSizeIterator
pub fn iter_mut_enumerated( &mut self, ) -> impl DoubleEndedIterator<Item = (DeBruijnId, &mut T)> + ExactSizeIterator
Iterate over the binding levels, from the innermost (0) out.
pub fn map_ref<'a, U>(&'a self, f: impl FnMut(&'a T) -> U) -> BindingStack<U>
Sourcepub fn place_at_outermost<U>(&mut self, val: &U) -> (U, &mut T)where
U: TyVisitable + Clone,
pub fn place_at_outermost<U>(&mut self, val: &U) -> (U, &mut T)where
U: TyVisitable + Clone,
Find the outermost binder where the given U can be moved to.
pub fn innermost(&self) -> &T
pub fn innermost_mut(&mut self) -> &mut T
pub fn outermost(&self) -> &T
pub fn outermost_mut(&mut self) -> &mut T
Trait Implementations§
Source§impl<T> Index<DeBruijnId> for BinderSlice<T>
impl<T> Index<DeBruijnId> for BinderSlice<T>
Source§impl<T> Index<RangeFrom<DeBruijnId>> for BinderSlice<T>
self[depth..] represents the binding stack seen from depth.
impl<T> Index<RangeFrom<DeBruijnId>> for BinderSlice<T>
self[depth..] represents the binding stack seen from depth.