package string_dict

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

Efficient static string dictionaries. By static, we mean that new key-value pairs cannot be added after the dictionary is created.

This uses the algorithm the OCaml compiler uses for pattern matching on strings.

type 'a t
include Ppx_hash_lib.Hashable.S1 with type 'a t := 'a t
val hash_fold_t : 'a Base__Ppx_hash_lib.hash_fold -> 'a t Base__Ppx_hash_lib.hash_fold
include Ppx_compare_lib.Comparable.S1 with type 'a t := 'a t
val compare : 'a Base__Ppx_compare_lib.compare -> 'a t Base__Ppx_compare_lib.compare
val sexp_of_t : ('a -> Base.Sexp.t) -> 'a t -> Base.Sexp.t

We don't use [@@deriving sexp], to avoid a circular dependency.

val t_of_sexp : (Base.Sexp.t -> 'a) -> Base.Sexp.t -> 'a t
val of_alist : (Base.string * 'a) Base.list -> ('a t, Base.string) Stdlib.result

Creates a dictionary from an association list. It is an error for the list to contain duplicate keys.

val of_alist_exn : (Base.string * 'a) Base.list -> 'a t
val find : 'a t -> Base.string -> 'a Base.option
val find_exn : 'a t -> Base.string -> 'a
val to_alist : 'a t -> (Base.string * 'a) Base.list
OCaml

Innovation. Community. Security.