Metadata.
Typed key-value dictionaries. Values of this type are used with various B0 definitions to specify metadata.
The module defines a few standard keys and a list syntax to write metadata literals:
let meta = B0_meta.v @@ B0_meta.[
authors, ["The project programmers"];
homepage, "https://example.org"]
XXX. They used to be serializable, see if we don't want that again.
Keys
The type for keys whose lookup value is of type 'a
.
Bindings
type binding =
| B : 'a key * 'a -> binding
The type for metadata bindings.
pp_binding
formats a binding using B00_std.Fmt.field
and the key's value print function.
The type for sugared lists of bindings. Just because we can.
v bs
is metadata with bindings vs
. If a key is defined more than once in bs
the last definition in the list takes over.
empty
is the empty metadata.
is_empty m
is true
iff m
is empty.
val mem : 'a key -> t -> bool
mem k m
is true
iff m
has a binding for k
.
val add : 'a key -> 'a -> t -> t
add k v m
is m
with k
bound to v
.
val tag : unit key -> t -> t
val rem : 'a key -> t -> t
rem k m
is m
wihtout a binding for k
.
val find : 'a key -> t -> 'a option
find k m
is the binding of k
in m
(if any).
find_binding k m
is the binding for k
in m
(if any).
val find_binding_by_name : string -> t -> binding option
find_binding_by_name n m
is the binding named n
in m
(if any).
val get : 'a key -> t -> 'a
get k m
is the binding of k
in m
. Raises Invalid_argument
if there is no such binding.
find_binding k m
is the binding for k
in m
. Raises Invalid_argument
if there is no such binding.
val get_binding_by_name : string -> t -> binding
get_binding_by_name n m
is the binding named n
in m
. Raises Invalid_argument
if there is no such binding.
val fold : (binding -> 'a -> 'a) -> t -> 'a -> 'a
fold f m acc
folds f
over the bindings of m
starting with acc
.
Formatting
pp
formats metadata using pp_bindings
.
pp_non_empty
is Fmt.cut
followed by pp
if metadata is non empty and Fmt.nop
otherwise.
Standard keys
End-user information
val authors : string list key
authors
describes a list of persons with authorship.
doc_tags
describes a list of documentation classification tags.
val homepage : string key
issues
is an URI to an issue tracker.
issues
is an URI to an issue tracker.
val licenses : string list key
val maintainers : string list key
maintainers
describe a list of persons with maintainership.
val online_doc : string key
online_doc
is an URI to online documentation.
repo
is an URI to a VCS system.
Entity tags
bench
tags benchmarking entities.
build
tags build system entities.
dev
tags development entities.
doc
tags documentation entities.
exe
tags executable entities.
test
tags testing entities.
lib
tags library entities.
Entity properties
val exe_name : string key
exe_name
is an executable name without the platform specific executable extension.