Struct ena::unify::UnificationTable
[−]
[src]
pub struct UnificationTable<K: UnifyKey> { /* fields omitted */ }
Table of unification keys and their values.
Methods
impl<K: UnifyKey> UnificationTable<K>
[src]
fn new() -> UnificationTable<K>
fn snapshot(&mut self) -> Snapshot<K>
Starts a new snapshot. Each snapshot must be either rolled back or committed in a "LIFO" (stack) order.
fn rollback_to(&mut self, snapshot: Snapshot<K>)
Reverses all changes since the last snapshot. Also removes any keys that have been created since then.
fn commit(&mut self, snapshot: Snapshot<K>)
Commits all changes since the last snapshot. Of course, they can still be undone if there is a snapshot further out.
fn new_key(&mut self, value: K::Value) -> K
Creates a fresh key with the given value.
fn unioned_keys<K1>(&mut self, key: K1) -> UnionedKeys<K> where
K1: Into<K>,
K1: Into<K>,
Returns an iterator over all keys unioned with key
.
fn len(&self) -> usize
Returns the number of keys created so far.
impl<'tcx, K, V> UnificationTable<K> where
K: UnifyKey<Value = V>,
V: UnifyValue,
[src]
K: UnifyKey<Value = V>,
V: UnifyValue,
//////////////////////////////////////////////////////////////////////// Public API
fn union<K1, K2>(&mut self, a_id: K1, b_id: K2) where
K1: Into<K>,
K2: Into<K>,
V: UnifyValue<Error = NoError>,
K1: Into<K>,
K2: Into<K>,
V: UnifyValue<Error = NoError>,
Unions two keys without the possibility of failure; only
applicable when unify values use NoError
as their error
type.
fn union_value<K1>(&mut self, id: K1, value: V) where
K1: Into<K>,
V: UnifyValue<Error = NoError>,
K1: Into<K>,
V: UnifyValue<Error = NoError>,
Unions a key and a value without the possibility of failure;
only applicable when unify values use NoError
as their error
type.
fn unioned<K1, K2>(&mut self, a_id: K1, b_id: K2) -> bool where
K1: Into<K>,
K2: Into<K>,
K1: Into<K>,
K2: Into<K>,
Given two keys, indicates whether they have been unioned together.
fn find<K1>(&mut self, id: K1) -> K where
K1: Into<K>,
K1: Into<K>,
Given a key, returns the (current) root key.
fn unify_var_var<K1, K2>(&mut self, a_id: K1, b_id: K2) -> Result<(), V::Error> where
K1: Into<K>,
K2: Into<K>,
K1: Into<K>,
K2: Into<K>,
Unions together two variables, merging their values. If merging the values fails, the error is propagated and this method has no effect.
fn unify_var_value<K1>(&mut self, a_id: K1, b: V) -> Result<(), V::Error> where
K1: Into<K>,
K1: Into<K>,
Sets the value of the key a_id
to b
, attempting to merge
with the previous value.
fn probe_value<K1>(&mut self, id: K1) -> V where
K1: Into<K>,
K1: Into<K>,
Returns the current value for the given key. If the key has been union'd, this will give the value from the current root.
Trait Implementations
impl<K: Clone + UnifyKey> Clone for UnificationTable<K>
[src]
fn clone(&self) -> UnificationTable<K>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more