package b0

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

Module B0_metaSource

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. The recommended way of formatting constant dictionaries is:

let meta =
  let open B0_meta in (* This can be omitted *)
  empty
  |> add authors ["The project programmers"]
  |> add homepage "https://example.org"
  |> tag B0_opam.Meta.tag

XXX. They used to be serializable, see if we don't want that again.

Keys

Sourcetype 'a key

The type for keys whose lookup value is of type 'a.

Sourcemodule Key : sig ... end

Metadata keys

Metadata

Sourcetype binding =
  1. | B : 'a key * 'a -> binding

The type for metadata bindings.

Sourceval pp_binding : binding B0_std.Fmt.t

pp_binding formats a binding using B0_std.Fmt.field and the key's value print function.

Sourcetype t

The type for metadata.

Sourceval empty : t

empty is the empty metadata.

Sourceval is_empty : t -> bool

is_empty m is true iff m is empty.

Sourceval mem : 'a key -> t -> bool

mem k m is true iff m has a binding for k.

Sourceval add : 'a key -> 'a -> t -> t

add k v m is m with k bound to v.

Sourceval add_if_some : 'a key -> 'a option -> t -> t

add_if_some k o m is m if o is None and m with k bound to v if o is Some v.

Sourceval tag : unit key -> t -> t

tag k m is add k () m.

Sourceval rem : 'a key -> t -> t

rem k m is m wihtout a binding for k.

Sourceval find : 'a key -> t -> 'a option

find k m is the binding of k in m (if any).

Sourceval find_binding : 'a key -> t -> binding option

find_binding k m is the binding for k in m (if any).

Sourceval find_binding_by_name : string -> t -> binding option

find_binding_by_name n m is the binding named n in m (if any).

Sourceval get : 'a key -> t -> 'a

get k m is the binding of k in m. Raises Invalid_argument if there is no such binding.

Sourceval get_binding : 'a key -> t -> binding

find_binding k m is the binding for k in m. Raises Invalid_argument if there is no such binding.

Sourceval 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.

Sourceval 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.

Sourceval pp_non_empty : t B0_std.Fmt.t

pp_non_empty is Fmt.cut followed by pp if metadata is non empty and Fmt.nop otherwise.

Standard keys

End-user information

Sourceval authors : string list key

authors describes a list of persons with authorship.

Sourceval description_tags : string list key

description_tags describes a list of classification tags used for documentation.

Sourceval description : string key

description is a long description for the entity.

Sourceval homepage : string key

issues is an URI to an issue tracker.

Sourceval issues : string key

issues is an URI to an issue tracker.

Sourceval licenses : string list key

licenses describes a list of licenses. Each license should be a SPDX license identifier.

Sourceval maintainers : string list key

maintainers describe a list of persons with maintainership.

Sourceval online_doc : string key

online_doc is an URI to online documentation.

Sourceval repo : string key

repo is an URI to a VCS system.

Sourceval synopsis : string key

synopsis is a one line synopsis for an entity.

Entity tags

Sourceval bench : unit key

bench tags benchmarking entities.

Sourceval build : unit key

build tags build system entities.

Sourceval dev : unit key

dev tags development entities.

Sourceval doc : unit key

doc tags documentation entities.

Sourceval exe : unit key

exe tags executable entities.

Sourceval test : unit key

test tags testing entities.

Sourceval lib : unit key

lib tags library entities.

Entity properties

Sourceval exe_name : string key

exe_name is an executable name without the platform specific executable extension. FIXME rename that to tool.

exe_file is an absolute file path to an executable build by the unit.