1Ephemeron.Kn.Make(3) OCaml library Ephemeron.Kn.Make(3)
2
3
4
6 Ephemeron.Kn.Make - Functor building an implementation of a weak hash
7 table
8
10 Module Ephemeron.Kn.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 type key
39
40
41
42
43 type 'a t
44
45
46
47
48
49 val create : int -> 'a t
50
51
52
53
54 val clear : 'a t -> unit
55
56
57
58
59 val reset : 'a t -> unit
60
61
62
63
64 val copy : 'a t -> 'a t
65
66
67
68
69 val add : 'a t -> key -> 'a -> unit
70
71
72
73
74 val remove : 'a t -> key -> unit
75
76
77
78
79 val find : 'a t -> key -> 'a
80
81
82
83
84 val find_opt : 'a t -> key -> 'a option
85
86
87
88
89 val find_all : 'a t -> key -> 'a list
90
91
92
93
94 val replace : 'a t -> key -> 'a -> unit
95
96
97
98
99 val mem : 'a t -> key -> bool
100
101
102
103
104 val length : 'a t -> int
105
106
107
108
109 val stats : 'a t -> Hashtbl.statistics
110
111
112
113
114 val add_seq : 'a t -> (key * 'a) Seq.t -> unit
115
116
117
118
119 val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
120
121
122
123
124 val of_seq : (key * 'a) Seq.t -> 'a t
125
126
127
128
129 val clean : 'a t -> unit
130
131 remove all dead bindings. Done automatically during automatic resizing.
132
133
134
135 val stats_alive : 'a t -> Hashtbl.statistics
136
137 same as Hashtbl.SeededS.stats but only count the alive bindings
138
139
140
141
142
143OCamldoc 2023-07-20 Ephemeron.Kn.Make(3)