package prom
Library
Module
Module type
Parameter
Class
Class type
A kv map (label) uniquely identifying a time series.
get_or k m ~default
returns the value associated to k
if present, and returns default
otherwise (if k
doesn't belong in m
).
update k f m
calls f (Some v)
if find k m = v
, otherwise it calls f None
. In any case, if the result is None
k
is removed from m
, and if the result is Some v'
then add k v' m
is returned.
Safe version of min_binding
.
Safe version of max_binding
.
Find smallest binding satisfying the monotonic predicate. See Map.S.find_first
.
Safe version of find_first
.
val merge_safe :
f:
(string SMap.t ->
[ `Left of 'a | `Right of 'b | `Both of 'a * 'b ] ->
'c option) ->
'a t ->
'b t ->
'c t
merge_safe ~f a b
merges the maps a
and b
together.
Union of both maps, using the function to combine bindings that belong to both inputs.
val add_iter : 'a t -> (string SMap.t * 'a) CCMap.iter -> 'a t
Like add_list
.
val of_iter : (string SMap.t * 'a) CCMap.iter -> 'a t
Like of_list
.
val to_iter : 'a t -> (string SMap.t * 'a) CCMap.iter
Like to_list
.
val of_seq : (string SMap.t * 'a) CCMap.sequence -> 'a t
val add_seq : 'a t -> (string SMap.t * 'a) CCMap.sequence -> 'a t
val to_seq : 'a t -> (string SMap.t * 'a) CCMap.sequence
Build a map from the given list of bindings k_i -> v_i
, added in order using add
. If a key occurs several times, only its last binding will be present in the result.
val keys : _ t -> string SMap.t CCMap.iter
Iterate on keys only.
val values : 'a t -> 'a CCMap.iter
Iterate on values only.
val pp :
?start:string ->
?stop:string ->
?arrow:string ->
?sep:string ->
string SMap.t CCMap.printer ->
'a CCMap.printer ->
'a t CCMap.printer