pub trait Substitutable: Sized {
    type Variable: Variable;
    type Factory: VariableFactory<Variable = Self::Variable>;
    type Interner: Default;

    // Required methods
    fn from_variable(subs: &Substitution<Self>, x: Self::Variable) -> Self;
    fn into_variable(&mut self, x: Self::Variable);
    fn is_unique(self_: &Self) -> bool;
    fn get_var(&self) -> Option<&Self::Variable>;
    fn traverse<'a, F>(&'a self, f: &mut F)
       where F: Walker<'a, Self>;
    fn instantiate(&self, subs: &Substitution<Self>) -> Self;

    // Provided methods
    fn get_id(&self) -> Option<u32> { ... }
    fn contains_variables(&self) -> bool { ... }
}
Expand description

Trait implemented on types which may contain substitutable variables

Required Associated Types§

Required Methods§

source

fn from_variable(subs: &Substitution<Self>, x: Self::Variable) -> Self

Constructs a new object from its variable type

source

fn into_variable(&mut self, x: Self::Variable)

source

fn is_unique(self_: &Self) -> bool

source

fn get_var(&self) -> Option<&Self::Variable>

Retrieves the variable if self is a variable otherwise returns None

source

fn traverse<'a, F>(&'a self, f: &mut F)
where F: Walker<'a, Self>,

source

fn instantiate(&self, subs: &Substitution<Self>) -> Self

Provided Methods§

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Substitutable for ArcKind

§

type Variable = u32

§

type Factory = ()

§

type Interner = NullInterner

source§

fn from_variable(_: &Substitution<Self>, x: u32) -> ArcKind

source§

fn into_variable(&mut self, x: Self::Variable)

source§

fn is_unique(self_: &Self) -> bool

source§

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

source§

fn traverse<'a, F>(&'a self, f: &mut F)
where F: Walker<'a, ArcKind>,

source§

fn instantiate(&self, _subs: &Substitution<Self>) -> Self

source§

impl Substitutable for RcType<Symbol>

§

type Variable = TypeVariable

§

type Factory = ArcKind

§

type Interner = TypeCache<Symbol, ArcType>

source§

fn from_variable(subs: &Substitution<Self>, var: TypeVariable) -> Self

source§

fn into_variable(&mut self, x: Self::Variable)

source§

fn is_unique(self_: &Self) -> bool

source§

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

source§

fn get_id(&self) -> Option<u32>

source§

fn traverse<'a, F>(&'a self, f: &mut F)
where F: Walker<'a, Self>,

source§

fn instantiate(&self, subs: &Substitution<Self>) -> Self

source§

fn contains_variables(&self) -> bool

Implementors§