Trait DeBruijnIndexed

Source
pub trait DeBruijnIndexed: Sized {
    // Required methods
    fn map_indices_from<F>(&self, start: usize, map_fn: F) -> Self
       where F: Fn(usize) -> usize + Clone;
    fn get_var(&self) -> Option<usize>;

    // Provided methods
    fn map_indices<F>(&self, map_fn: F) -> Self
       where F: Fn(usize) -> usize + Clone { ... }
    fn increment_indices_from_by(&self, start: usize, amount: usize) -> Self { ... }
    fn increment_indices_by(&self, amount: usize) -> Self { ... }
    fn increment_indices(&self) -> Self { ... }
}
Expand description

Syntax nodes which have free variables represented by DeBruijn indices

Required Methods§

Source

fn map_indices_from<F>(&self, start: usize, map_fn: F) -> Self
where F: Fn(usize) -> usize + Clone,

Source

fn get_var(&self) -> Option<usize>

Provided Methods§

Source

fn map_indices<F>(&self, map_fn: F) -> Self
where F: Fn(usize) -> usize + Clone,

Source

fn increment_indices_from_by(&self, start: usize, amount: usize) -> Self

Increment de Bruijn indices in the term which are at least equal to start by amount. This is required for example, when adjusting de Bruijn indices in an expression where new variables are bound.

Source

fn increment_indices_by(&self, amount: usize) -> Self

Increment de Bruijn indices in the term by amount.

Source

fn increment_indices(&self) -> Self

Increment de Bruijn indices in the term by one.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T: DeBruijnIndexed> DeBruijnIndexed for Option<T>

Source§

fn map_indices_from<F>(&self, start: usize, map_fn: F) -> Self
where F: Fn(usize) -> usize + Clone,

Source§

fn get_var(&self) -> Option<usize>

Source§

impl<T: DeBruijnIndexed> DeBruijnIndexed for Box<T>

Source§

fn map_indices_from<F>(&self, start: usize, map_fn: F) -> Self
where F: Fn(usize) -> usize + Clone,

Source§

fn get_var(&self) -> Option<usize>

Implementors§