package batteries

  1. Overview
  2. Docs
A community-maintained standard library extension

Install

Dune Dependency

Authors

Maintainers

Sources

v3.7.2.tar.gz
md5=1fd7bddce07cf5d244fc9427f7b5e4d4
sha512=c0f2a0fdc8253e0ea999d8d4c58bfbf32b18d251a2e1d9656bf279de5f01a33e9aabac3af4d95f465f8b671e7711ebd37218043face233340a0c11b08fa62f78

doc/batteries.unthreaded/BatHashtbl/Cap/index.html

Module BatHashtbl.CapSource

Capabilities for hashtables.

@documents Hashtbl.Cap

Sourcetype ('a, 'b, 'c) t constraint 'c = [< `Read | `Write ]

The type of a hashtable.

Constructors
Sourceval create : int -> ('a, 'b, _) t
Sourceval of_table : ('a, 'b) Hashtbl.t -> ('a, 'b, _) 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.

Sourceval to_table : ('a, 'b, [ `Read | `Write ]) t -> ('a, 'b) 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.

Sourceval read_only : ('a, 'b, [> `Read ]) t -> ('a, 'b, [ `Read ]) t

Drop to read-only permissions.

This operation involves no copying.

Sourceval write_only : ('a, 'b, [> `Write ]) t -> ('a, 'b, [ `Write ]) t

Drop to write-only permissions.

This operation involves no copying.

Base operations
Sourceval length : ('a, 'b, _) t -> int
Sourceval is_empty : ('a, 'b, _) t -> bool
Sourceval add : ('a, 'b, [> `Write ]) t -> 'a -> 'b -> unit
Sourceval remove : ('a, 'b, [> `Write ]) t -> 'a -> unit
Sourceval remove_all : ('a, 'b, [> `Write ]) t -> 'a -> unit
Sourceval replace : ('a, 'b, [> `Write ]) t -> 'a -> 'b -> unit
Sourceval copy : ('a, 'b, [> `Read ]) t -> ('a, 'b, _) t
Sourceval clear : ('a, 'b, [> `Write ]) t -> unit
Sourceval stats : ('a, 'b, _) t -> statistics
Searching
Sourceval find : ('a, 'b, [> `Read ]) t -> 'a -> 'b
Sourceval find_all : ('a, 'b, [> `Read ]) t -> 'a -> 'b list
Sourceval find_default : ('a, 'b, [> `Read ]) t -> 'a -> 'b -> 'b
Sourceval find_option : ('a, 'b, [> `Read ]) t -> 'a -> 'b option
Sourceval exists : ('a -> 'b -> bool) -> ('a, 'b, [> `Read ]) t -> bool
Sourceval mem : ('a, 'b, [> `Read ]) t -> 'a -> bool
Traversing
Sourceval iter : ('a -> 'b -> unit) -> ('a, 'b, [> `Read ]) t -> unit
Sourceval for_all : ('a -> 'b -> bool) -> ('a, 'b, [> `Read ]) t -> bool
Sourceval fold : ('a -> 'b -> 'c -> 'c) -> ('a, 'b, [> `Read ]) t -> 'c -> 'c
Sourceval map : ('a -> 'b -> 'c) -> ('a, 'b, [> `Read ]) t -> ('a, 'c, _) t
Sourceval map_inplace : ('a -> 'b -> 'b) -> ('a, 'b, [> `Write ]) t -> unit
Sourceval filter : ('a -> bool) -> ('key, 'a, [> `Read ]) t -> ('key, 'a, _) t
Sourceval filter_inplace : ('a -> bool) -> ('key, 'a, [> `Write ]) t -> unit
Sourceval filteri : ('key -> 'a -> bool) -> ('key, 'a, [> `Read ]) t -> ('key, 'a, _) t
Sourceval filteri_inplace : ('key -> 'a -> bool) -> ('key, 'a, [> `Write ]) t -> unit
Sourceval filter_map : ('key -> 'a -> 'b option) -> ('key, 'a, [> `Read ]) t -> ('key, 'b, _) t
Sourceval filter_map_inplace : ('key -> 'a -> 'a option) -> ('key, 'a, [> `Write ]) t -> unit
Sourceval merge : ('key -> 'a option -> 'b option -> 'c option) -> ('key, 'a, [> `Read ]) t -> ('key, 'b, [> `Read ]) t -> ('key, 'c, _) t
Sourceval merge_all : ('key -> 'a list -> 'b list -> 'c list) -> ('key, 'a, [> `Read ]) t -> ('key, 'b, [> `Read ]) t -> ('key, 'c, _) t
Conversions
Sourceval keys : ('a, 'b, [> `Read ]) t -> 'a BatEnum.t
Sourceval values : ('a, 'b, [> `Read ]) t -> 'b BatEnum.t
Sourceval enum : ('a, 'b, [> `Read ]) t -> ('a * 'b) BatEnum.t
Sourceval of_enum : ('a * 'b) BatEnum.t -> ('a, 'b, _) t
Sourceval to_list : ('a, 'b, [> `Read ]) t -> ('a * 'b) list
Sourceval of_list : ('a * 'b) list -> ('a, 'b, _) t
Boilerplate code
Printing
Sourceval 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 ]) t -> unit
Override modules
Sourcemodule Exceptionless : sig ... end

Operations on BatHashtbl.Cap without exceptions.

Sourcemodule Labels : sig ... end

Operations on BatHashtbl.Cap with labels.

OCaml

Innovation. Community. Security.