Module type CCHashTrie.S
val empty : 'a t
val is_empty : _ t -> bool
val singleton : key -> 'a -> 'a t
val add : key -> 'a -> 'a t -> 'a t
val mem : key -> _ t -> bool
val get : key -> 'a t -> 'a option
val get_exn : key -> 'a t -> 'a
- raises Not_found
if key not present.
val update : key -> f:('a option -> 'a option) -> 'a t -> 'a t
update k ~f m
callsf (Some v)
ifget k m = Some v
,f None
otherwise. Then, iff
returnsSome v'
it bindsk
tov'
, iff
returnsNone
it removesk
.
val add_mut : id:Transient.t -> key -> 'a -> 'a t -> 'a t
add_mut ~id k v m
behaves likeadd k v m
, except it will mutate in place whenever possible. Changes done with anid
might affect all versions of the structure obtained with the sameid
(but not other versions).- raises Transient.Frozen
if
id
is frozen.
val remove_mut : id:Transient.t -> key -> 'a t -> 'a t
Same as
remove
, but modifies in place whenever possible.- raises Transient.Frozen
if
id
is frozen.
val update_mut : id:Transient.t -> key -> f:('a option -> 'a option) -> 'a t -> 'a t
Same as
update
but with mutability.- raises Transient.Frozen
if
id
is frozen.
val cardinal : _ t -> int
val choose : 'a t -> (key * 'a) option
val choose_exn : 'a t -> key * 'a
- raises Not_found
if not pair was found.
val iter : f:(key -> 'a -> unit) -> 'a t -> unit
val fold : f:('b -> key -> 'a -> 'b) -> x:'b -> 'a t -> 'b
Conversions
val to_list : 'a t -> (key * 'a) list
val add_list : 'a t -> (key * 'a) list -> 'a t
val add_list_mut : id:Transient.t -> 'a t -> (key * 'a) list -> 'a t
- raises Frozen
if the ID is frozen.
val of_list : (key * 'a) list -> 'a t
val add_seq : 'a t -> (key * 'a) sequence -> 'a t
val add_seq_mut : id:Transient.t -> 'a t -> (key * 'a) sequence -> 'a t
- raises Frozen
if the ID is frozen.