package b0

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

Build packs.

A build pack gathers a set of build units and attaches metadata to it.

Packs

type t

The type for build units.

val v : ?doc:string -> ?meta:B0_meta.t -> string -> locked:bool -> B0_unit.t list -> t

v n us is a build pack named n made of build units us and described by doc. locked defaults to false, see locked for the semantics.

val locked : t -> bool

locked is true if the pack when used in a build mandates a locked build.

val units : t -> B0_unit.t list

units p are the units of p.

B0 definition API

include B0_def.S with type t := t

Named values

val define : ?doc:string -> ?meta:B0_meta.t -> string -> B0_def.def

define ~doc ~meta n defines name n in the current scope with documentation string doc (defaults to "undocumented")e and metadata meta (defaults to B0_meta.empty). Defining a duplicate value in a scope raises Duplicate.

val def_kind : string

def_kind is the kind of defined value.

val def : t -> B0_def.def

def v is the definition of value v.

val name : t -> string

name v is v's name.

val basename : t -> string

basename v is v's name without the scope.

val doc : t -> string

doc v is v's documentation string.

val equal : t -> t -> bool

equal v0 v1 is true iff v0 and v1 have the same name.

val compare : t -> t -> int

compare v0 v1 sorts v0 and v0 in lexicographical order.

Metadata

val meta : t -> B0_meta.t

meta v is v's metadata.

val has_meta : 'a B0_meta.key -> t -> bool

has_meta k u is B0_meta.mem k (B0_unit.meta u).

val find_meta : 'a B0_meta.key -> t -> 'a option

find_meta k u is B0_meta.find k (B0_unit.meta u).

val get_meta : 'a B0_meta.key -> t -> ('a, string) result

get_meta m k u is Ok v if find_meta k u is Some v and a final user friendly error message if None.

Add & Lookup

val add : t -> unit

add v adds the value v to the list of defined values.

val list : unit -> t list

list () is the list of units.

val find : string -> t option

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

val get : string -> t

get n looks up the value named n and errors the B0 file if there no such n.

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

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

val get_or_hint : string -> (t, string) result

get_or_hint n is the value named n or an error message that indicates that n could not be found with suggested names.

val get_list_or_hint : ?empty_means_all:bool -> string list -> (t list, string) result

get_list_or_hint ns are the value named ns or an error that indicates the names that could not be found with suggested names. If empty_means_all is true (defaults to false) an empty ns returns list () sorted by name.

Formatters

val pp_name_str : string B0_std.Fmt.t

pp_name_str v pretty prints value names.

val pp_name : t B0_std.Fmt.t

pp_name v formats v's name.

val pp_doc : t B0_std.Fmt.t

pp_doc formats v's doc string.

val pp_synopsis : t B0_std.Fmt.t

pp_synopsis formats v's name and its doc string.

val pp : t B0_std.Fmt.t

pp formats v 's name, its doc string and its metadata dictionary.

Value set and maps

module Set : Set.S with type elt = t

Value sets.

module Map : Map.S with type key = t

Value maps.

OCaml

Innovation. Community. Security.