package b0

  1. Overview
  2. Docs

Metadata keys

Typed keys

val v : ?doc:string -> pp_value:'a B00_std.Fmt.t -> string -> 'a key

v name ~doc ~pp_value is a new metadata key with:

  • name the name used for UI interaction and to format the key name when its binding is formatted . The name should be globally unique, the module automatically renames it if that happens not to be the case.
  • doc is a documentation string for the key.
  • pp_value is used to format the key values.
val tag : ?doc:string -> string -> unit key

tag ~doc name is new tag key. Tags denote booleans, presence in metadata means true, absence means false.

val name : 'a key -> string

name k is k's name.

val doc : 'a key -> string

doc k is k's documentation string.

val pp_value : 'a key -> 'a B00_std.Fmt.t

pp k is k's value formatter.

Existential keys

type t =
  1. | V : 'a key -> t

The type for existential keys.

val equal : t -> t -> bool

equal k0 k1 is true iff k and k' are the same key.

val compare : t -> t -> int

compare k0 k1 is a total order on keys compatible with equal.

val pp_name_str : string B00_std.Fmt.t

pp_name_str formats a key name.

val pp : t B00_std.Fmt.t

pp formats the key name with pp_name_str

Lookup keys by name

For UI purposes a map from key names to existential keys is maintained by the module.

val find : string -> t option

find n is the key named n (if any).

val get : string -> t

get n is the key named n. Raises Invalid_argument if there is no such key.

val get_or_suggest : string -> (t, t list) result

get_or_suggest n is the key named n or or a (possibly empty) list of suggested values whose name could match n.

OCaml

Innovation. Community. Security.