File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
+ //! An implementation of union-find and (optionally)
12
+ //! congruence-closure. See the `unify` and `cc` modules for more
13
+ //! details. Note that congruence-closure requires you to opt-in to
14
+ //! the feature "congruence-closure".
15
+
11
16
// The CC code uses `impl Trait`
12
17
#![ cfg_attr( feature = "congruence-closure" , feature( conservative_impl_trait) ) ]
13
18
#![ cfg_attr( feature = "bench" , feature( test) ) ]
Original file line number Diff line number Diff line change 18
18
//! ensure that any changes you make this with this pointer are rolled back, you must invoke
19
19
//! `record` to record any changes you make and also supplying a delegate capable of reversing
20
20
//! those changes.
21
+
21
22
use self :: UndoLog :: * ;
22
23
23
24
use std:: mem;
Original file line number Diff line number Diff line change 8
8
// option. This file may not be copied, modified, or distributed
9
9
// except according to those terms.
10
10
11
+ //! Union-find implementation. The main type is `UnificationTable`.
12
+ //!
13
+ //! You can define your own type for the *keys* in the table, but you
14
+ //! must implement `UnifyKey` for that type. The assumption is that
15
+ //! keys will be newtyped integers, hence we require that they
16
+ //! implement `Copy`.
17
+ //!
18
+ //! Keys can have values associated with them. The assumption is that
19
+ //! these values are cheaply cloneable (ideally, `Copy`), and some of
20
+ //! the interfaces are oriented around that assumption. If you just
21
+ //! want the classical "union-find" algorithm where you group things
22
+ //! into sets, use the `Value` type of `()`.
23
+ //!
24
+ //! When you have keys with non-trivial values, you must also define
25
+ //! how those values can be merged. If this merging is infallible, you
26
+ //! should implement the `InfallibleUnifyValue` trait, which unlocks
27
+ //! various more ergonomic methods (e.g., `union()` in place of
28
+ //! `unify_var_var()`).
29
+
11
30
use std:: marker;
12
31
use std:: fmt:: Debug ;
13
32
use std:: marker:: PhantomData ;
You can’t perform that action at this time.
0 commit comments