Struct rustc_data_structures::unify::UnificationTable [] [src]

pub struct UnificationTable<S> where
    S: UnificationStore
{ /* fields omitted */ }

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>> or InPlaceUnificationTable<K>):
    • This is the standard mutable mode, where the array is modified in place.
    • To do backtracking, you can employ the snapshot and rollback_to methods.
  • persistent (UnificationTable<Persistent<K>> or PersistentUnificationTable<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.

Methods

impl<S> UnificationTable<S> where
    S: UnificationStore
[src]

[src]

[src]

Starts a new snapshot. Each snapshot must be either rolled back or committed in a "LIFO" (stack) order.

[src]

Reverses all changes since the last snapshot. Also removes any keys that have been created since then.

[src]

Commits all changes since the last snapshot. Of course, they can still be undone if there is a snapshot further out.

[src]

Creates a fresh key with the given value.

[src]

Returns the number of keys created so far.

impl<'tcx, S, K, V> UnificationTable<S> where
    K: UnifyKey<Value = V>,
    S: UnificationStore<Key = K, Value = V>,
    V: UnifyValue
[src]

//////////////////////////////////////////////////////////////////////// Public API

[src]

Unions two keys without the possibility of failure; only applicable when unify values use NoError as their error type.

[src]

Unions a key and a value without the possibility of failure; only applicable when unify values use NoError as their error type.

[src]

Given two keys, indicates whether they have been unioned together.

[src]

Given a key, returns the (current) root key.

[src]

Unions together two variables, merging their values. If merging the values fails, the error is propagated and this method has no effect.

[src]

Sets the value of the key a_id to b, attempting to merge with the previous value.

[src]

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<S> Clone for UnificationTable<S> where
    S: UnificationStore + Clone
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<S> Debug for UnificationTable<S> where
    S: UnificationStore + Debug
[src]

[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<S> Send for UnificationTable<S> where
    S: Send

impl<S> Sync for UnificationTable<S> where
    S: Sync