Module BatHashtbl.Cap

module Cap: sig .. end

Capabilities for hashtables.


type ('a, 'b, [< `Read | `Write ]) t 

The type of a hashtable.

Constructors
val create : int -> ('a, 'b, [< `Read | `Write ]) t
val of_table : ('a, 'b) Stdlib.Hashtbl.t -> ('a, 'b, [< `Read | `Write ]) t

Adopt a regular hashtable as a capability hashtble, allowing to decrease capabilities if necessary.

This operation involves no copying. In other words, in let cap = of_table a in ..., any modification in a will also have effect on cap and reciprocally.

val to_table : ('a, 'b, [ `Read | `Write ]) t -> ('a, 'b) Stdlib.Hashtbl.t

Return a capability hashtable as a regular hashtable.

This operation requires both read and write permissions on the capability table and involves no copying. In other words, in let a = of_table cap in ..., any modification in a will also have effect on cap and reciprocally.

val read_only : ('a, 'b, [< `Read | `Write > `Read ]) t ->
('a, 'b, [ `Read ]) t

Drop to read-only permissions.

This operation involves no copying.

val write_only : ('a, 'b, [< `Read | `Write > `Write ]) t ->
('a, 'b, [ `Write ]) t

Drop to write-only permissions.

This operation involves no copying.

Base operations
val length : ('a, 'b, [< `Read | `Write ]) t -> int
val is_empty : ('a, 'b, [< `Read | `Write ]) t -> bool
val add : ('a, 'b, [< `Read | `Write > `Write ]) t -> 'a -> 'b -> unit
val remove : ('a, 'b, [< `Read | `Write > `Write ]) t -> 'a -> unit
val remove_all : ('a, 'b, [< `Read | `Write > `Write ]) t -> 'a -> unit
val replace : ('a, 'b, [< `Read | `Write > `Write ]) t -> 'a -> 'b -> unit
val copy : ('a, 'b, [< `Read | `Write > `Read ]) t ->
('a, 'b, [< `Read | `Write ]) t
val clear : ('a, 'b, [< `Read | `Write > `Write ]) t -> unit
Searching
val find : ('a, 'b, [< `Read | `Write > `Read ]) t -> 'a -> 'b
val find_all : ('a, 'b, [< `Read | `Write > `Read ]) t -> 'a -> 'b list
val find_default : ('a, 'b, [< `Read | `Write > `Read ]) t -> 'a -> 'b -> 'b
val find_option : ('a, 'b, [< `Read | `Write > `Read ]) t -> 'a -> 'b option
val mem : ('a, 'b, [< `Read | `Write > `Read ]) t -> 'a -> bool
Traversing
val iter : ('a -> 'b -> unit) ->
('a, 'b, [< `Read | `Write > `Read ]) t -> unit
val fold : ('a -> 'b -> 'c -> 'c) ->
('a, 'b, [< `Read | `Write > `Read ]) t -> 'c -> 'c
val map : ('a -> 'b -> 'c) ->
('a, 'b, [< `Read | `Write > `Read ]) t ->
('a, 'c, [< `Read | `Write ]) t
val map_inplace : ('a -> 'b -> 'b) ->
('a, 'b, [< `Read | `Write > `Write ]) t -> unit
val filter : ('a -> bool) ->
('key, 'a, [< `Read | `Write > `Read ]) t ->
('key, 'a, [< `Read | `Write ]) t
val filter_inplace : ('a -> bool) ->
('key, 'a, [< `Read | `Write > `Write ]) t -> unit
val filteri : ('key -> 'a -> bool) ->
('key, 'a, [< `Read | `Write > `Read ]) t ->
('key, 'a, [< `Read | `Write ]) t
val filteri_inplace : ('key -> 'a -> bool) ->
('key, 'a, [< `Read | `Write > `Write ]) t -> unit
val filter_map : ('key -> 'a -> 'b option) ->
('key, 'a, [< `Read | `Write > `Read ]) t ->
('key, 'b, [< `Read | `Write ]) t
val filter_map_inplace : ('key -> 'a -> 'a option) ->
('key, 'a, [< `Read | `Write > `Write ]) t -> unit
val merge : ('key -> 'a option -> 'b option -> 'c option) ->
('key, 'a, [< `Read | `Write > `Read ]) t ->
('key, 'b, [< `Read | `Write > `Read ]) t ->
('key, 'c, [< `Read | `Write ]) t
val merge_all : ('key -> 'a list -> 'b list -> 'c list) ->
('key, 'a, [< `Read | `Write > `Read ]) t ->
('key, 'b, [< `Read | `Write > `Read ]) t ->
('key, 'c, [< `Read | `Write ]) t
Conversions
val keys : ('a, 'b, [< `Read | `Write > `Read ]) t -> 'a BatEnum.t
val values : ('a, 'b, [< `Read | `Write > `Read ]) t -> 'b BatEnum.t
val enum : ('a, 'b, [< `Read | `Write > `Read ]) t -> ('a * 'b) BatEnum.t
val of_enum : ('a * 'b) BatEnum.t -> ('a, 'b, [< `Read | `Write ]) t
val to_list : ('a, 'b, [< `Read | `Write > `Read ]) t -> ('a * 'b) list
val of_list : ('a * 'b) list -> ('a, 'b, [< `Read | `Write ]) t
Boilerplate code
Printing
val print : ?first:string ->
?last:string ->
?sep:string ->
?kvsep:string ->
('a BatInnerIO.output -> 'b -> unit) ->
('a BatInnerIO.output -> 'c -> unit) ->
'a BatInnerIO.output ->
('b, 'c, [< `Read | `Write > `Read ]) t -> unit
Override modules
module Exceptionless: sig .. end

Operations on BatHashtbl.Cap without exceptions.

module Labels: sig .. end

Operations on BatHashtbl.Cap with labels.