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