Struct rslogic::state::State
[−]
[src]
pub struct State<T> where
T: PartialEq + Unif<T>, { /* fields omitted */ }
A logical state, containing a collection of variable bindings.
Variables are stored with one level of indirection, to indicate variables that have been unified before being bound.
Methods
impl<T> State<T> where
T: PartialEq + Unif<T>,
[src]
T: PartialEq + Unif<T>,
fn empty() -> State<T>
Creates an empty state.
fn binds_var(&self, var: &Var) -> bool
Returns true
if the variable is bound in the state.
fn get<'a>(&'a self, var: &Var) -> Option<&'a T>
Returns a reference to the value bound to the variable in the state, or None if the var4iable is not bound.
fn unify_val(&self, var: &Var, val: T) -> PossibleStates<T>
Attempts to unify a variable with a value. If the variable is not bound, returns a new state containing a binding to the value. If the variable is already bound, returns the unification of the two values.
fn unify_var(&self, v1: &Var, v2: &Var) -> PossibleStates<T>
Attempts to unify two variables.
fn make_var(&self) -> (Var, State<T>)
Creates a new variable and a new state with which it is usable.
Trait Implementations
impl<T> Clone for State<T> where
T: PartialEq + Unif<T>,
[src]
T: PartialEq + Unif<T>,