package containers-data
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=92143ceb4785ae5f8a07f3ab4ab9f6f32d31ead0536e9be4fdb818dd3c677e58
sha512=5fa80189d0e177af2302b48e72b70299d51fc36ac2019e1cbf389ff6a7f4705b10089405b5a719b3e4845b0d1349a47a967f865dc2e4e3f0d5a0167ef6c31431
doc/containers-data/CCMixtbl/index.html
Module CCMixtblSource
Hash Table with Heterogeneous Keys
From https://github.com/mjambon/mixtbl (thanks to him). Example:
let inj_int = CCMixtbl.create_inj () ;;
let tbl = CCMixtbl.create 10 ;;
assert_equal None (CCMixtbl.get ~inj:inj_int tbl "a");;
CCMixtbl.set inj_int tbl "a" 1;;
assert_equal (Some 1) (CCMixtbl.get ~inj:inj_int tbl "a");;
let inj_string = CCMixtbl.create_inj () ;;
CCMixtbl.set inj_string tbl "b" "Hello";
assert_equal (Some "Hello") (CCMixtbl.get inj_string tbl "b");;
assert_equal None (CCMixtbl.get inj_string tbl "a");;
assert_equal (Some 1) (CCMixtbl.get inj_int tbl "a");;
CCMixtbl.set inj_string tbl "a" "Bye";;
assert_equal None (CCMixtbl.get inj_int tbl "a");;
assert_equal (Some "Bye") (CCMixtbl.get inj_string tbl "a");;A hash table containing values of different types. The type parameter 'a represents the type of the keys.
An accessor for values of type 'b in any table. Values put in the table using a key can only be retrieved using this very same key.
Return a value that works for a given type of values. This function is normally called once for each type of value. Several keys may be created for the same type, but a value set with a given setter can only be retrieved with the matching getter. The same key can be reused across multiple tables (although not in a thread-safe way).
Get the value corresponding to this key, if it exists and belongs to the same key.
Find the value for the given key, which must be of the right type.
Is the given key in the table, with the right type?
Iterators
All the bindings that come from the corresponding injection.