package b0
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha512=e9aa779e66c08fc763019f16d4706f465d16c05d6400b58fbd0313317ef33ddea51952e2b058db28e65f7ddb7012f328c8bf02d8f1da17bb543348541a2587f0
doc/b0.file/B0_meta/Key/index.html
Module B0_meta.Key
Source
Keys.
Typed keys
make name ~default ~pp_value ~doc
is a new metadata key with:
name
the name used for UI interaction. It should be globally unique, the module automatically renames it if that happens not to be the case.default
is an optional default value for the key when undefined in a dictionary.pp_value
is used to format the key values for end-users.doc
is a documentation string for the key.
make_tag ~doc name
is a new tag key named name
. Denote booleans that are false when absent (that's their default value). In effect this is strictly equivalent to:
make ?doc name ~default:false ~pp_value:Fmt.bool
Properties
get_default k
is the default value of k
. Raises Invalid_argument
if k
has no default.
Formatting
pp k
is k
's value formatter.
pp_name k
formats k
's name with pp_name_str
.
Existential keys
Predicates and comparison
Formatting
pp_name_str
formats a key name.
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.
get n
is the key named n
. Raises Invalid_argument
if there is no such key.
get_or_suggest n
is the key named n
or or a (possibly empty) list of suggested values whose name could match n
.
get_or_hint n
is the key named n
or an error message that indicates that n
could not be found with suggested names.