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
/// A generic trait for anything that would like to be used in a [`GenericCache`], allowing easy
/// extensibility using a container not covered by this library.
///
/// [`HashCache`] and [`BTreeCache`] are both just using `GenericCache` under the hood, by
/// implementing this trait on `HashMap` and `BTreeMap`.
///
/// If this trait doesn't quite fit with your container, you can also implement fully your own
/// [`FnCache`], which requires a bit more work than using this trait, but gives you full
/// generality. This is how [`VecCache`] is implemented, because it is not sparse, and must fill
/// all earlier indices.
/// A trait to clear the container, for cases when caching may need to be temporary during some
/// calcuations, but may grow unbounded over the course of the program otherwise.
/// A trait to let you see how many values the container is holding.
/// A trait to reserve space in a container, in case you know how many values are about to enter
/// and can avoid reallocations by reserving more space at once.
/// A trait to remove items from a container, to prevent growth without bound.