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.
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.
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
.
Clears all unifications that have been performed, resetting to
the initial state. The values of each variable are given by
the closure.
Returns the number of keys created so far.
////////////////////////////////////////////////////////////////////////
Public API
Unions two keys without the possibility of failure; only
applicable when unify values use NoError
as their error
type.
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.
Unions together two variables, merging their values. If
merging the values fails, the error is propagated and this
method has no effect.
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.
Performs copy-assignment from source
. Read more
Returns the "default value" for a type. Read more
Formats the value using the given formatter. Read more
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
type Error = <U as TryFrom<T>>::Error
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Mutably borrows from an owned value. Read more
Create an error for a missing method specialization. Defaults to panicking with type, trait & method names. S
is the encoder/decoder state type, T
is the type being encoded/decoded, and the arguments are the names of the trait and method that should've been overridden. Read more