Skip to content

Commit 2f9a5e5

Browse files
committed
add some minimal documentation
1 parent 216e21c commit 2f9a5e5

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

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+
1116
// The CC code uses `impl Trait`
1217
#![cfg_attr(feature = "congruence-closure", feature(conservative_impl_trait))]
1318
#![cfg_attr(feature = "bench", feature(test))]

src/snapshot_vec.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
//! ensure that any changes you make this with this pointer are rolled back, you must invoke
1919
//! `record` to record any changes you make and also supplying a delegate capable of reversing
2020
//! those changes.
21+
2122
use self::UndoLog::*;
2223

2324
use std::mem;

src/unify/mod.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,25 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

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+
1130
use std::marker;
1231
use std::fmt::Debug;
1332
use std::marker::PhantomData;

0 commit comments

Comments
 (0)