Subst

Trait Subst 

Source
pub trait Subst<V>: Sized {
    // Required methods
    fn is_var(&self) -> Option<SubstName<V>>;
    fn subst(&self, var: &Name<V>, value: &V) -> Self;

    // Provided method
    fn subst_all(&self, subst_map: &HashMap<Name<V>, V>) -> Self
       where V: Clone,
             Self: Clone { ... }
}
Expand description

Trait for types that support substitution

Required Methods§

Source

fn is_var(&self) -> Option<SubstName<V>>

Check if this term is a variable and return its name

Source

fn subst(&self, var: &Name<V>, value: &V) -> Self

Perform substitution of value for var in self

Provided Methods§

Source

fn subst_all(&self, subst_map: &HashMap<Name<V>, V>) -> Self
where V: Clone, Self: Clone,

Perform substitution with a mapping

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<A: Subst<V> + Clone, B: Subst<V> + Clone, V> Subst<V> for (A, B)

Source§

fn is_var(&self) -> Option<SubstName<V>>

Source§

fn subst(&self, var: &Name<V>, value: &V) -> Self

Source§

impl<T: Subst<V> + Clone, V> Subst<V> for Option<T>

Source§

fn is_var(&self) -> Option<SubstName<V>>

Source§

fn subst(&self, var: &Name<V>, value: &V) -> Self

Source§

impl<T: Subst<V> + Clone, V> Subst<V> for Box<T>

Source§

fn is_var(&self) -> Option<SubstName<V>>

Source§

fn subst(&self, var: &Name<V>, value: &V) -> Self

Source§

impl<T: Subst<V> + Clone, V> Subst<V> for Vec<T>

Source§

fn is_var(&self) -> Option<SubstName<V>>

Source§

fn subst(&self, var: &Name<V>, value: &V) -> Self

Source§

impl<V> Subst<V> for i32

Source§

fn is_var(&self) -> Option<SubstName<V>>

Source§

fn subst(&self, _var: &Name<V>, _value: &V) -> Self

Source§

impl<V> Subst<V> for usize

Source§

fn is_var(&self) -> Option<SubstName<V>>

Source§

fn subst(&self, _var: &Name<V>, _value: &V) -> Self

Source§

impl<V> Subst<V> for String

Source§

fn is_var(&self) -> Option<SubstName<V>>

Source§

fn subst(&self, _var: &Name<V>, _value: &V) -> Self

Implementors§

Source§

impl<T: Clone> Subst<T> for Name<T>

Source§

impl<T: Subst<V> + Clone, U: Subst<V> + Clone, V: Clone> Subst<V> for Bind<(Name<V>, U), Box<T>>

Source§

impl<T: Subst<V> + Clone, V: Clone> Subst<V> for Bind<Vec<Name<V>>, Box<T>>

Source§

impl<T: Subst<V> + Clone, V: Clone> Subst<V> for Bind<Name<V>, Box<T>>