1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
use crateKeyLayout;
use crateSplit;
use crateKeyPiece;
use crateSlotStorage;
use Vec;
/// Compile time configuration of a [`GenMap`](crate::GenMap).
/// # Examples
///
/// ```
/// use gen_map::{Config, GenMap, Split};
///
/// /// Four byte keys, and slots are never retired.
/// struct Small;
///
/// impl Config for Small {
/// // index type
/// type Idx = u16;
/// // generation type
/// type Gen = u16;
/// // How a key stores the index and the generation.
/// type Layout = Split;
/// // The collection the slots live in.
/// type Storage<S> = Vec<S>;
/// const WRAP_ON_OVERFLOW: bool = true;
/// }
///
/// let mut map = GenMap::<&str, Small>::new_with_config();
/// let key = map.insert("hello");
/// assert_eq!(core::mem::size_of_val(&key), 4);
/// assert_eq!(map[key], "hello");
/// ```
/// The config a [`GenMap`](crate::GenMap) uses when none is named.
///
/// Keys are a `u32` index and a `u32` generation stored as two fields,
/// slots live in a `Vec`, and slots retire when their generation overflows.
/// It needs the `alloc` feature, which is on by default.
;