Struct rustc_ap_rustc_data_structures::unify::UnificationTable [−][src]
pub struct UnificationTable<S> where
S: UnificationStoreBase, { /* fields omitted */ }
Expand description
Table of unification keys and their values. You must define a key type K
that implements the UnifyKey
trait. Unification tables can be used in two-modes:
- in-place (
UnificationTable<InPlace<K>>
orInPlaceUnificationTable<K>
):- This is the standard mutable mode, where the array is modified in place.
- To do backtracking, you can employ the
snapshot
androllback_to
methods.
- persistent (
UnificationTable<Persistent<K>>
orPersistentUnificationTable<K>
):- In this mode, we use a persistent vector to store the data, so that cloning the table is an O(1) operation.
- This implies that ordinary operations are quite a bit slower though.
- Requires the
persistent
feature be selected in your Cargo.toml file.
Implementations
Starts a new snapshot. Each snapshot must be either rolled back or committed in a “LIFO” (stack) order.
Reverses all changes since the last snapshot. Also removes any keys that have been created since then.
Commits all changes since the last snapshot. Of course, they can still be undone if there is a snapshot further out.
pub fn new_key(
&mut self,
value: <S as UnificationStoreBase>::Value
) -> <S as UnificationStoreBase>::Key
[src]
pub fn new_key(
&mut self,
value: <S as UnificationStoreBase>::Value
) -> <S as UnificationStoreBase>::Key
[src]Starts a new snapshot. Each snapshot must be either Creates a fresh key with the given value.
Reserve memory for num_new_keys
to be created. Does not
actually create the new keys; you must then invoke new_key
.
pub fn reset_unifications(
&mut self,
value: impl FnMut(<S as UnificationStoreBase>::Key) -> <S as UnificationStoreBase>::Value
)
[src]
pub fn reset_unifications(
&mut self,
value: impl FnMut(<S as UnificationStoreBase>::Key) -> <S as UnificationStoreBase>::Value
)
[src]Clears all unifications that have been performed, resetting to the initial state. The values of each variable are given by the closure.
impl<S, K, V> UnificationTable<S> where
K: UnifyKey<Value = V>,
V: UnifyValue,
S: UnificationStoreMut<Key = K, Value = V>,
[src]
impl<S, K, V> UnificationTable<S> where
K: UnifyKey<Value = V>,
V: UnifyValue,
S: UnificationStoreMut<Key = K, Value = V>,
[src]//////////////////////////////////////////////////////////////////////// Public API
Unions two keys without the possibility of failure; only
applicable when unify values use NoError
as their error
type.
pub fn union_value<K1>(&mut self, id: K1, value: V) where
V: UnifyValue<Error = NoError>,
K1: Into<K>,
[src]
pub fn union_value<K1>(&mut self, id: K1, value: V) where
V: UnifyValue<Error = NoError>,
K1: Into<K>,
[src]Unions a key and a value without the possibility of failure;
only applicable when unify values use NoError
as their error
type.
Given two keys, indicates whether they have been unioned together.
Given a key, returns the (current) root key.
pub fn unify_var_var<K1, K2>(
&mut self,
a_id: K1,
b_id: K2
) -> Result<(), <V as UnifyValue>::Error> where
K1: Into<K>,
K2: Into<K>,
[src]
pub fn unify_var_var<K1, K2>(
&mut self,
a_id: K1,
b_id: K2
) -> Result<(), <V as UnifyValue>::Error> where
K1: Into<K>,
K2: Into<K>,
[src]Unions together two variables, merging their values. If merging the values fails, the error is propagated and this method has no effect.
pub fn unify_var_value<K1>(
&mut self,
a_id: K1,
b: V
) -> Result<(), <V as UnifyValue>::Error> where
K1: Into<K>,
[src]
pub fn unify_var_value<K1>(
&mut self,
a_id: K1,
b: V
) -> Result<(), <V as UnifyValue>::Error> where
K1: Into<K>,
[src]Sets the value of the key a_id
to b
, attempting to merge
with the previous value.
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
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl<S> RefUnwindSafe for UnificationTable<S> where
S: RefUnwindSafe,
impl<S> Send for UnificationTable<S> where
S: Send,
impl<S> Sync for UnificationTable<S> where
S: Sync,
impl<S> Unpin for UnificationTable<S> where
S: Unpin,
impl<S> UnwindSafe for UnificationTable<S> where
S: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
pub fn vzip(self) -> V