Skip to main content

BinderSlice

Struct BinderSlice 

Source
#[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>

Source

fn from_slice(stack: &[T]) -> &Self

Source

fn from_slice_mut(stack: &mut [T]) -> &mut Self

Source

pub fn is_empty(&self) -> bool

Source

pub fn len(&self) -> usize

Source

pub fn depth(&self) -> DeBruijnId

Source

pub fn as_bound_var<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.

Source

fn real_index(&self, id: DeBruijnId) -> Option<usize>

Helper that computes the real index into the underlying slice.

Source

pub fn get(&self, id: DeBruijnId) -> Option<&T>

Source

pub fn get_var<'a, Id: Idx, Inner>( &'a self, var: DeBruijnVar<Id>, ) -> Option<&'a Inner::Output>
where T: Borrow<Inner>, Inner: HasIdxVecOf<Id> + 'a,

Source

pub fn get_mut(&mut self, id: DeBruijnId) -> Option<&mut T>

Source

pub fn iter(&self) -> impl DoubleEndedIterator<Item = &T> + ExactSizeIterator

Iterate over the binding levels, from the innermost (0) out.

Source

pub fn iter_mut( &mut self, ) -> impl DoubleEndedIterator<Item = &mut T> + ExactSizeIterator

Iterate mutably over the binding levels, from the innermost (0) out.

Source

pub fn indices( &self, ) -> impl DoubleEndedIterator<Item = DeBruijnId> + ExactSizeIterator + use<T>

Iterate over the binding levels, from the innermost (0) out.

Source

pub fn iter_enumerated( &self, ) -> impl DoubleEndedIterator<Item = (DeBruijnId, &T)> + ExactSizeIterator

Iterate over the binding levels, from the innermost (0) out.

Source

pub fn iter_mut_enumerated( &mut self, ) -> impl DoubleEndedIterator<Item = (DeBruijnId, &mut T)> + ExactSizeIterator

Iterate over the binding levels, from the innermost (0) out.

Source

pub fn map_ref<'a, U>(&'a self, f: impl FnMut(&'a T) -> U) -> BindingStack<U>

Source

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.

Source

pub fn innermost(&self) -> &T

Source

pub fn innermost_mut(&mut self) -> &mut T

Source

pub fn outermost(&self) -> &T

Source

pub fn outermost_mut(&mut self) -> &mut T

Trait Implementations§

Source§

impl<T> Index<DeBruijnId> for BinderSlice<T>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, id: DeBruijnId) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<T> Index<RangeFrom<DeBruijnId>> for BinderSlice<T>

self[depth..] represents the binding stack seen from depth.

Source§

type Output = BinderSlice<T>

The returned type after indexing.
Source§

fn index(&self, range: RangeFrom<DeBruijnId>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<T> IndexMut<DeBruijnId> for BinderSlice<T>

Source§

fn index_mut(&mut self, id: DeBruijnId) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T> IndexMut<RangeFrom<DeBruijnId>> for BinderSlice<T>

Source§

fn index_mut(&mut self, range: RangeFrom<DeBruijnId>) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more

Auto Trait Implementations§

§

impl<T> !Sized for BinderSlice<T>

§

impl<T> Freeze for BinderSlice<T>
where [T]: Freeze,

§

impl<T> RefUnwindSafe for BinderSlice<T>

§

impl<T> Send for BinderSlice<T>
where [T]: Send,

§

impl<T> Sync for BinderSlice<T>
where [T]: Sync,

§

impl<T> Unpin for BinderSlice<T>
where [T]: Unpin,

§

impl<T> UnsafeUnpin for BinderSlice<T>

§

impl<T> UnwindSafe for BinderSlice<T>
where [T]: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more