函子 Ephemeron.K1.Make

module Make: 
functor (H : Hashtbl.HashedType-> Ephemeron.S with type key = H.t

建構弱式雜湊表實作的函子

參數
H : Hashtbl.HashedType

提供與一般雜湊表相同的介面。然而,由於綁定是弱式的,即使 mem h k 為真,後續的 find h k 仍可能拋出 Not_found 異常,因為垃圾回收器可能在這兩者之間執行。

type key 
type !'a t 
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val length : 'a t -> int
val stats : 'a t -> Hashtbl.statistics
val add_seq : 'a t -> (key * 'a) Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
val of_seq : (key * 'a) Seq.t -> 'a t
val clean : 'a t -> unit

移除所有已失效的綁定。在自動調整大小期間會自動執行。

val stats_alive : 'a t -> Hashtbl.statistics

Hashtbl.SeededS.stats 相同,但僅計算存活的綁定