package async_kernel

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Like Weak_hashtbl, but automatically collects keys with unused data, rather than requiring user code to call remove_keys_with_unused_data.

include module type of Weak_hashtbl
type ('a, 'b) t
val sexp_of_t : ('a -> Sexplib0.Sexp.t) -> ('b -> Sexplib0.Sexp.t) -> ('a, 'b) t -> Sexplib0.Sexp.t
val create : ?growth_allowed:Base.bool -> ?size:Base.int -> (module Base.Hashtbl.Key.S with type t = 'a) -> ('a, 'b) t

growth_allowed and size are both optionally passed on to the underlying call to Hashtbl.create.

module Using_hashable : sig ... end
val mem : ('a, _) t -> 'a -> Base.bool
val find : ('a, 'b) t -> 'a -> 'b Heap_block.t Base.option
val find_or_add : ('a, 'b) t -> 'a -> default:(Base.unit -> 'b Heap_block.t) -> 'b Heap_block.t
val remove : ('a, 'b) t -> 'a -> Base.unit
val clear : (_, _) t -> Base.unit
val add_exn : ('a, 'b) t -> key:'a -> data:'b Heap_block.t -> Base.unit
val replace : ('a, 'b) t -> key:'a -> data:'b Heap_block.t -> Base.unit
val key_is_using_space : ('a, _) t -> 'a -> Base.bool

key_is_using_space t key returns true if key is using some space in t. mem t key implies key_is_using_space t key, but it is also possible that that key_is_using_space t key && not (mem t key).

val reclaim_space_for_keys_with_unused_data : [ `Do_not_use ] -> unit
val set_run_when_unused_data : [ `Do_not_use ] -> unit
OCaml

Innovation. Community. Security.