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
val hash_fold_t : (Base.Hash.state -> 'a -> Base.Hash.state) -> Base.Hash.state -> 'a t -> Base.Hash.state
val compare : ('a -> 'a -> Base.int) -> 'a t -> 'a t -> Base.int
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) Caml.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.