1Ephemeron.K1.Make(3) OCaml library Ephemeron.K1.Make(3)
2
3
4
6 Ephemeron.K1.Make - Functor building an implementation of a weak hash
7 table
8
10 Module Ephemeron.K1.Make
11
13 Module Make
14 : functor (H : Hashtbl.HashedType) -> sig end
15
16
17 Functor building an implementation of a weak hash table
18
19
20 Parameters:
21
22 "H"
23
24 Stdlib.Hashtbl.HashedType
25
26
27
28
29
30
31
32
33
34 Propose the same interface as usual hash table. However since the bind‐
35 ings are weak, even if mem h k is true, a subsequent find h k may raise
36 Not_found because the garbage collector can run between the two.
37
38 Moreover, the table shouldn't be modified during a call to iter . Use
39 filter_map_inplace in this case.
40
41 type key
42
43
44
45
46 type 'a t
47
48
49
50
51
52 val create : int -> 'a t
53
54
55
56
57 val clear : 'a t -> unit
58
59
60
61
62 val reset : 'a t -> unit
63
64
65
66
67 val copy : 'a t -> 'a t
68
69
70
71
72 val add : 'a t -> key -> 'a -> unit
73
74
75
76
77 val remove : 'a t -> key -> unit
78
79
80
81
82 val find : 'a t -> key -> 'a
83
84
85
86
87 val find_opt : 'a t -> key -> 'a option
88
89
90
91
92 val find_all : 'a t -> key -> 'a list
93
94
95
96
97 val replace : 'a t -> key -> 'a -> unit
98
99
100
101
102 val mem : 'a t -> key -> bool
103
104
105
106
107 val iter : (key -> 'a -> unit) -> 'a t -> unit
108
109
110
111
112 val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
113
114
115
116
117 val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
118
119
120
121
122 val length : 'a t -> int
123
124
125
126
127 val stats : 'a t -> Hashtbl.statistics
128
129
130
131
132 val to_seq : 'a t -> (key * 'a) Seq.t
133
134
135
136
137 val to_seq_keys : 'a t -> key Seq.t
138
139
140
141
142 val to_seq_values : 'a t -> 'a Seq.t
143
144
145
146
147 val add_seq : 'a t -> (key * 'a) Seq.t -> unit
148
149
150
151
152 val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
153
154
155
156
157 val of_seq : (key * 'a) Seq.t -> 'a t
158
159
160
161
162 val clean : 'a t -> unit
163
164 remove all dead bindings. Done automatically during automatic resizing.
165
166
167
168 val stats_alive : 'a t -> Hashtbl.statistics
169
170 same as Hashtbl.SeededS.stats but only count the alive bindings
171
172
173
174
175
176OCamldoc 2023-01-23 Ephemeron.K1.Make(3)