You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: crates/iddqd/README.md
+16-16Lines changed: 16 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,18 +12,18 @@ Maps where keys are borrowed from values.
12
12
13
13
This crate consists of several map types, collectively called **ID maps**:
14
14
15
-
*[`IdOrdMap`](https://docs.rs/iddqd/0.3.12/iddqd/id_ord_map/imp/struct.IdOrdMap.html): A B-Tree based map where keys are borrowed from values.
16
-
*[`IdHashMap`](https://docs.rs/iddqd/0.3.12/iddqd/id_hash_map/imp/struct.IdHashMap.html): A hash map where keys are borrowed from values.
17
-
*[`BiHashMap`](https://docs.rs/iddqd/0.3.12/iddqd/bi_hash_map/imp/struct.BiHashMap.html): A bijective (1:1) hash map with two keys, borrowed from
15
+
*[`IdOrdMap`](https://docs.rs/iddqd/0.3.13/iddqd/id_ord_map/imp/struct.IdOrdMap.html): A B-Tree based map where keys are borrowed from values.
16
+
*[`IdHashMap`](https://docs.rs/iddqd/0.3.13/iddqd/id_hash_map/imp/struct.IdHashMap.html): A hash map where keys are borrowed from values.
17
+
*[`BiHashMap`](https://docs.rs/iddqd/0.3.13/iddqd/bi_hash_map/imp/struct.BiHashMap.html): A bijective (1:1) hash map with two keys, borrowed from
18
18
values.
19
-
*[`TriHashMap`](https://docs.rs/iddqd/0.3.12/iddqd/tri_hash_map/imp/struct.TriHashMap.html): A trijective (1:1:1) hash map with three keys, borrowed
19
+
*[`TriHashMap`](https://docs.rs/iddqd/0.3.13/iddqd/tri_hash_map/imp/struct.TriHashMap.html): A trijective (1:1:1) hash map with three keys, borrowed
20
20
from values.
21
21
22
22
## Usage
23
23
24
24
* Pick your ID map type.
25
-
* Depending on the ID map type, implement [`IdOrdItem`](https://docs.rs/iddqd/0.3.12/iddqd/id_ord_map/trait_defs/trait.IdOrdItem.html), [`IdHashItem`](https://docs.rs/iddqd/0.3.12/iddqd/id_hash_map/trait_defs/trait.IdHashItem.html),
26
-
[`BiHashItem`](https://docs.rs/iddqd/0.3.12/iddqd/bi_hash_map/trait_defs/trait.BiHashItem.html), or [`TriHashItem`](https://docs.rs/iddqd/0.3.12/iddqd/tri_hash_map/trait_defs/trait.TriHashItem.html) for your value type.
25
+
* Depending on the ID map type, implement [`IdOrdItem`](https://docs.rs/iddqd/0.3.13/iddqd/id_ord_map/trait_defs/trait.IdOrdItem.html), [`IdHashItem`](https://docs.rs/iddqd/0.3.13/iddqd/id_hash_map/trait_defs/trait.IdHashItem.html),
26
+
[`BiHashItem`](https://docs.rs/iddqd/0.3.13/iddqd/bi_hash_map/trait_defs/trait.BiHashItem.html), or [`TriHashItem`](https://docs.rs/iddqd/0.3.13/iddqd/tri_hash_map/trait_defs/trait.TriHashItem.html) for your value type.
27
27
* Store values in the ID map type.
28
28
29
29
### Features
@@ -49,19 +49,19 @@ issues encountered using Rust’s default map types in practice at Oxide.
49
49
50
50
We’ve also sometimes needed to index a set of data by more than one key, or
51
51
perhaps map one key to another. For that purpose, this crate provides
52
-
[`BiHashMap`](https://docs.rs/iddqd/0.3.12/iddqd/bi_hash_map/imp/struct.BiHashMap.html) and [`TriHashMap`](https://docs.rs/iddqd/0.3.12/iddqd/tri_hash_map/imp/struct.TriHashMap.html).
52
+
[`BiHashMap`](https://docs.rs/iddqd/0.3.13/iddqd/bi_hash_map/imp/struct.BiHashMap.html) and [`TriHashMap`](https://docs.rs/iddqd/0.3.13/iddqd/tri_hash_map/imp/struct.TriHashMap.html).
53
53
54
-
*[`BiHashMap`](https://docs.rs/iddqd/0.3.12/iddqd/bi_hash_map/imp/struct.BiHashMap.html) has two keys, and provides a bijection (1:1 relationship)
54
+
*[`BiHashMap`](https://docs.rs/iddqd/0.3.13/iddqd/bi_hash_map/imp/struct.BiHashMap.html) has two keys, and provides a bijection (1:1 relationship)
55
55
between the keys.
56
-
*[`TriHashMap`](https://docs.rs/iddqd/0.3.12/iddqd/tri_hash_map/imp/struct.TriHashMap.html) has three keys, and provides a trijection (1:1:1
56
+
*[`TriHashMap`](https://docs.rs/iddqd/0.3.13/iddqd/tri_hash_map/imp/struct.TriHashMap.html) has three keys, and provides a trijection (1:1:1
57
57
relationship) between the keys.
58
58
59
59
As a consequence of the general API structure, maps can have arbitrary
60
60
non-key data associated with them as well.
61
61
62
62
### Examples
63
63
64
-
An example for [`IdOrdMap`](https://docs.rs/iddqd/0.3.12/iddqd/id_ord_map/imp/struct.IdOrdMap.html):
64
+
An example for [`IdOrdMap`](https://docs.rs/iddqd/0.3.13/iddqd/id_ord_map/imp/struct.IdOrdMap.html):
65
65
66
66
````rust
67
67
useiddqd::{IdOrdItem, IdOrdMap, id_upcast};
@@ -103,7 +103,7 @@ for user in &users {
103
103
104
104
Keys don’t have to be borrowed from the value. For smaller `Copy` types,
105
105
it’s recommended that you use owned keys. Here’s an example of using
106
-
[`IdOrdMap`](https://docs.rs/iddqd/0.3.12/iddqd/id_ord_map/imp/struct.IdOrdMap.html) with a small integer key:
106
+
[`IdOrdMap`](https://docs.rs/iddqd/0.3.13/iddqd/id_ord_map/imp/struct.IdOrdMap.html) with a small integer key:
107
107
108
108
````rust
109
109
structRecord {
@@ -125,7 +125,7 @@ impl IdOrdItem for Record {
125
125
// ...
126
126
````
127
127
128
-
An example for [`IdHashMap`](https://docs.rs/iddqd/0.3.12/iddqd/id_hash_map/imp/struct.IdHashMap.html), showing a complex borrowed key. Here,
128
+
An example for [`IdHashMap`](https://docs.rs/iddqd/0.3.13/iddqd/id_hash_map/imp/struct.IdHashMap.html), showing a complex borrowed key. Here,
129
129
“complex” means that the key is not a reference itself, but a struct that
130
130
returns references to more than one field from the value.
131
131
@@ -209,7 +209,7 @@ For a key type `T::Key<'_>` and a lookup type `L`:
209
209
must hash in the same way as `T::Key<'_>`. Typically, this is done by
210
210
ensuring that enum variants and struct fields are in the same
211
211
order[^proptest].
212
-
*[`IdOrdMap`](https://docs.rs/iddqd/0.3.12/iddqd/id_ord_map/imp/struct.IdOrdMap.html) requires `L: Comparable<T::Key<'_>>`, which in turn requires
212
+
*[`IdOrdMap`](https://docs.rs/iddqd/0.3.13/iddqd/id_ord_map/imp/struct.IdOrdMap.html) requires `L: Comparable<T::Key<'_>>`, which in turn requires
213
213
`Equivalent<T::Key<'_>>`. (There’s no need for `L` to implement `Ord` or
214
214
`Eq` itself.)
215
215
@@ -264,11 +264,11 @@ If you see a gap in testing, new tests are welcome. Thank you!
264
264
265
265
Most of this crate is no-std compatible, though [`alloc`](https://doc.rust-lang.org/nightly/alloc/index.html) is required.
266
266
267
-
The [`IdOrdMap`](https://docs.rs/iddqd/0.3.12/iddqd/id_ord_map/imp/struct.IdOrdMap.html) type is not currently no-std compatible due to its use of a
267
+
The [`IdOrdMap`](https://docs.rs/iddqd/0.3.13/iddqd/id_ord_map/imp/struct.IdOrdMap.html) type is not currently no-std compatible due to its use of a
268
268
thread-local. This thread-local is just a way to work around a limitation in
269
269
std’s `BTreeMap` API, though. Either a custom B-Tree implementation, or a
270
270
platform-specific notion of thread locals, would suffice to make
@@ -280,7 +280,7 @@ platform-specific notion of thread locals, would suffice to make
280
280
default.*
281
281
*`default-hasher`: Enables the `DefaultHashBuilder` type. Disable this
282
282
feature to require a hash builder type parameter to be passed into
283
-
[`IdHashMap`](https://docs.rs/iddqd/0.3.12/iddqd/id_hash_map/imp/struct.IdHashMap.html), [`BiHashMap`](https://docs.rs/iddqd/0.3.12/iddqd/bi_hash_map/imp/struct.BiHashMap.html), and [`TriHashMap`](https://docs.rs/iddqd/0.3.12/iddqd/tri_hash_map/imp/struct.TriHashMap.html). *Enabled by default.*
283
+
[`IdHashMap`](https://docs.rs/iddqd/0.3.13/iddqd/id_hash_map/imp/struct.IdHashMap.html), [`BiHashMap`](https://docs.rs/iddqd/0.3.13/iddqd/bi_hash_map/imp/struct.BiHashMap.html), and [`TriHashMap`](https://docs.rs/iddqd/0.3.13/iddqd/tri_hash_map/imp/struct.TriHashMap.html). *Enabled by default.*
284
284
*`proptest`: Enables [`proptest`](https://docs.rs/proptest/1.7.0/proptest/index.html) support for all ID map types, providing
285
285
[`Arbitrary`] implementations and strategies for property-based testing.
0 commit comments