1Ephemeron.S(3) OCaml library Ephemeron.S(3)
2
3
4
6 Ephemeron.S - The output signature of the functors Ephemeron.K1.Make
7 and Ephemeron.K2.Make.
8
10 Module type Ephemeron.S
11
13 Module type S
14 = sig end
15
16
17 The output signature of the functors Ephemeron.K1.Make and
18 Ephemeron.K2.Make . These hash tables are weak in the keys. If all the
19 keys of a binding are alive the binding is kept, but if one of the keys
20 of the binding is dead then the binding is removed.
21
22
23
24
25
26
27
28 Propose the same interface as usual hash table. However since the bind‐
29 ings are weak, even if mem h k is true, a subsequent find h k may raise
30 Not_found because the garbage collector can run between the two.
31
32 type key
33
34
35
36
37 type 'a t
38
39
40
41
42
43 val create : int -> 'a t
44
45
46
47
48 val clear : 'a t -> unit
49
50
51
52
53 val reset : 'a t -> unit
54
55
56
57
58 val copy : 'a t -> 'a t
59
60
61
62
63 val add : 'a t -> key -> 'a -> unit
64
65
66
67
68 val remove : 'a t -> key -> unit
69
70
71
72
73 val find : 'a t -> key -> 'a
74
75
76
77
78 val find_opt : 'a t -> key -> 'a option
79
80
81
82
83 val find_all : 'a t -> key -> 'a list
84
85
86
87
88 val replace : 'a t -> key -> 'a -> unit
89
90
91
92
93 val mem : 'a t -> key -> bool
94
95
96
97
98 val length : 'a t -> int
99
100
101
102
103 val stats : 'a t -> Hashtbl.statistics
104
105
106
107
108 val add_seq : 'a t -> (key * 'a) Seq.t -> unit
109
110
111
112
113 val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
114
115
116
117
118 val of_seq : (key * 'a) Seq.t -> 'a t
119
120
121
122
123 val clean : 'a t -> unit
124
125 remove all dead bindings. Done automatically during automatic resizing.
126
127
128
129 val stats_alive : 'a t -> Hashtbl.statistics
130
131 same as Hashtbl.SeededS.stats but only count the alive bindings
132
133
134
135
136
137OCamldoc 2023-07-20 Ephemeron.S(3)