1Ephemeron.K1(3) OCamldoc Ephemeron.K1(3)
2
3
4
6 Ephemeron.K1 - no description
7
9 Module Ephemeron.K1
10
12 Module K1
13 : sig end
14
15
16
17
18
19
20
21 type ('k, 'd) t
22
23
24 an ephemeron with one key
25
26
27
28 val create : unit -> ('k, 'd) t
29
30
31 Ephemeron.K1.create () creates an ephemeron with one key. The data and
32 the key are empty
33
34
35
36 val get_key : ('k, 'd) t -> 'k option
37
38
39 Ephemeron.K1.get_key eph returns None if the key of eph is empty, Some
40 x (where x is the key) if it is full.
41
42
43
44 val get_key_copy : ('k, 'd) t -> 'k option
45
46
47 Ephemeron.K1.get_key_copy eph returns None if the key of eph is empty,
48 Some x (where x is a (shallow) copy of the key) if it is full. This
49 function has the same GC friendliness as Weak.get_copy
50
51 If the element is a custom block it is not copied.
52
53
54
55 val set_key : ('k, 'd) t -> 'k -> unit
56
57
58 Ephemeron.K1.set_key eph el sets the key of eph to be a (full) key to
59 el
60
61
62
63
64 val unset_key : ('k, 'd) t -> unit
65
66
67 Ephemeron.K1.unset_key eph el sets the key of eph to be an empty key.
68 Since there is only one key, the ephemeron starts behaving like a ref‐
69 erence on the data.
70
71
72
73 val check_key : ('k, 'd) t -> bool
74
75
76 Ephemeron.K1.check_key eph returns true if the key of the eph is full,
77 false if it is empty. Note that even if Ephemeron.K1.check_key eph
78 returns true , a subsequent Ephemeron.K1.get_key eph can return None .
79
80
81
82 val blit_key : ('k, 'a) t -> ('k, 'b) t -> unit
83
84
85 Ephemeron.K1.blit_key eph1 eph2 sets the key of eph2 with the key of
86 eph1 . Contrary to using Ephemeron.K1.get_key followed by
87 Ephemeron.K1.set_key or Ephemeron.K1.unset_key this function does not
88 prevent the incremental GC from erasing the value in its current cycle.
89
90
91
92 val get_data : ('k, 'd) t -> 'd option
93
94
95 Ephemeron.K1.get_data eph returns None if the data of eph is empty,
96 Some x (where x is the data) if it is full.
97
98
99
100 val get_data_copy : ('k, 'd) t -> 'd option
101
102
103 Ephemeron.K1.get_data_copy eph returns None if the data of eph is
104 empty, Some x (where x is a (shallow) copy of the data) if it is full.
105 This function has the same GC friendliness as Weak.get_copy
106
107 If the element is a custom block it is not copied.
108
109
110
111 val set_data : ('k, 'd) t -> 'd -> unit
112
113
114 Ephemeron.K1.set_data eph el sets the data of eph to be a (full) data
115 to el
116
117
118
119
120 val unset_data : ('k, 'd) t -> unit
121
122
123 Ephemeron.K1.unset_data eph el sets the key of eph to be an empty key.
124 The ephemeron starts behaving like a weak pointer.
125
126
127
128 val check_data : ('k, 'd) t -> bool
129
130
131 Ephemeron.K1.check_data eph returns true if the data of the eph is
132 full, false if it is empty. Note that even if Ephemeron.K1.check_data
133 eph returns true , a subsequent Ephemeron.K1.get_data eph can return
134 None .
135
136
137
138 val blit_data : ('a, 'd) t -> ('b, 'd) t -> unit
139
140
141 Ephemeron.K1.blit_data eph1 eph2 sets the data of eph2 with the data of
142 eph1 . Contrary to using Ephemeron.K1.get_data followed by
143 Ephemeron.K1.set_data or Ephemeron.K1.unset_data this function does not
144 prevent the incremental GC from erasing the value in its current cycle.
145
146
147 module Make : functor (H : Hashtbl.HashedType) -> sig end
148
149
150 Functor building an implementation of a weak hash table
151
152
153 module MakeSeeded : functor (H : Hashtbl.SeededHashedType) -> sig end
154
155
156 Functor building an implementation of a weak hash table. The seed is
157 similar to the one of Hashtbl.MakeSeeded .
158
159
160
161
162
1632018-04-14 source: Ephemeron.K1(3)