Struct rustc_data_structures::unify::UnificationTable
[−]
pub struct UnificationTable<S> where
S: UnificationStore, { /* fields omitted */ }
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
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.
Methods
impl<S> UnificationTable<S> where
S: UnificationStore,
impl<S> UnificationTable<S> where
S: UnificationStore,
pub fn new() -> UnificationTable<S>
pub fn new() -> UnificationTable<S>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
pub fn snapshot(&mut self) -> Snapshot<S>
pub fn snapshot(&mut self) -> Snapshot<S>
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Starts a new snapshot. Each snapshot must be either rolled back or committed in a "LIFO" (stack) order.
pub fn rollback_to(&mut self, snapshot: Snapshot<S>)
pub fn rollback_to(&mut self, snapshot: Snapshot<S>)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Reverses all changes since the last snapshot. Also removes any keys that have been created since then.
pub fn commit(&mut self, snapshot: Snapshot<S>)
pub fn commit(&mut self, snapshot: Snapshot<S>)
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
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 UnificationStore>::Value
) -> <S as UnificationStore>::Key
pub fn new_key(
&mut self,
value: <S as UnificationStore>::Value
) -> <S as UnificationStore>::Key
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Creates a fresh key with the given value.
pub fn len(&self) -> usize
pub fn len(&self) -> usize
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
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,
impl<'tcx, S, K, V> UnificationTable<S> where
K: UnifyKey<Value = V>,
S: UnificationStore<Key = K, Value = V>,
V: UnifyValue,
//////////////////////////////////////////////////////////////////////// Public API
pub fn union<K1, K2>(&mut self, a_id: K1, b_id: K2) where
K1: Into<K>,
K2: Into<K>,
V: UnifyValue<Error = NoError>,
pub fn union<K1, K2>(&mut self, a_id: K1, b_id: K2) where
K1: Into<K>,
K2: Into<K>,
V: UnifyValue<Error = NoError>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
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
K1: Into<K>,
V: UnifyValue<Error = NoError>,
pub fn union_value<K1>(&mut self, id: K1, value: V) where
K1: Into<K>,
V: UnifyValue<Error = NoError>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Unions a key and a value without the possibility of failure;
only applicable when unify values use NoError
as their error
type.
pub fn unioned<K1, K2>(&mut self, a_id: K1, b_id: K2) -> bool where
K1: Into<K>,
K2: Into<K>,
pub fn unioned<K1, K2>(&mut self, a_id: K1, b_id: K2) -> bool where
K1: Into<K>,
K2: Into<K>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Given two keys, indicates whether they have been unioned together.
pub fn find<K1>(&mut self, id: K1) -> K where
K1: Into<K>,
pub fn find<K1>(&mut self, id: K1) -> K where
K1: Into<K>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
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>,
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>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
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>,
pub fn unify_var_value<K1>(
&mut self,
a_id: K1,
b: V
) -> Result<(), <V as UnifyValue>::Error> where
K1: Into<K>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
Sets the value of the key a_id
to b
, attempting to merge
with the previous value.
pub fn probe_value<K1>(&mut self, id: K1) -> V where
K1: Into<K>,
pub fn probe_value<K1>(&mut self, id: K1) -> V where
K1: Into<K>,
🔬 This is a nightly-only experimental API. (rustc_private
)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml
instead?
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,
impl<S> Clone for UnificationTable<S> where
S: UnificationStore + Clone,
fn clone(&self) -> UnificationTable<S>
fn clone(&self) -> UnificationTable<S>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<S> Debug for UnificationTable<S> where
S: UnificationStore + Debug,
impl<S> Debug for UnificationTable<S> where
S: UnificationStore + Debug,
Auto Trait Implementations
impl<S> Send for UnificationTable<S> where
S: Send,
impl<S> Send for UnificationTable<S> where
S: Send,
impl<S> Sync for UnificationTable<S> where
S: Sync,
impl<S> Sync for UnificationTable<S> where
S: Sync,