mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
doc
This commit is contained in:
parent
397f41c4fa
commit
caaecda7f7
3 changed files with 20 additions and 21 deletions
|
|
@ -131,6 +131,7 @@ Documentation [here](http://cedeela.fr/~simon/software/containers).
|
|||
with fast merges
|
||||
- `CCHashconsedSet`, a set structure with sharing of sub-structures
|
||||
- `CCGraph`, a small collection of graph algorithms
|
||||
- `CCBitField`, a type-safe implementation of bitfields that fit in `int`
|
||||
|
||||
### Containers.io
|
||||
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ such as:
|
|||
Various data structures.
|
||||
|
||||
{!modules:
|
||||
CCBitField
|
||||
CCBV
|
||||
CCCache
|
||||
CCFQueue
|
||||
|
|
|
|||
|
|
@ -6,6 +6,23 @@
|
|||
up to 30 or 62 bits (depending on the architecture) in
|
||||
a relatively type-safe way.
|
||||
|
||||
{[
|
||||
module B = CCBitField.Make(struct end);;
|
||||
|
||||
#install_printer B.pp;;
|
||||
|
||||
let x = B.int ~name:"x" ~width:3;;
|
||||
let y = B.int ~name:"y" ~width:2;;
|
||||
let z = B.bool ~name:"z" ();;
|
||||
|
||||
let f = B.(empty |> set x 3 |> set y 1);;
|
||||
|
||||
B.get z f ;;
|
||||
|
||||
B.(f |> set z true |> get z) ;;
|
||||
|
||||
]}
|
||||
|
||||
{b status: experimental}
|
||||
@since NEXT_RELEASE *)
|
||||
|
||||
|
|
@ -75,27 +92,7 @@ module type BITFIELD = sig
|
|||
(** Print the bitfield using the current list of fields *)
|
||||
end
|
||||
|
||||
(** Create a new bitfield type,
|
||||
|
||||
{[
|
||||
module B = CCBitField.Make(struct end);;
|
||||
|
||||
#install_printer B.pp;;
|
||||
|
||||
let x = B.int ~name:"x" ~width:3;;
|
||||
let y = B.int ~name:"y" ~width:2;;
|
||||
let z = B.bool ~name:"z" ();;
|
||||
|
||||
let f = B.(empty |> set x 3 |> set y 1);;
|
||||
|
||||
B.get z f ;;
|
||||
|
||||
B.(f |> set z true |> get z) ;;
|
||||
|
||||
]}
|
||||
|
||||
|
||||
*)
|
||||
(** Create a new bitfield type *)
|
||||
module Make(X : EMPTY) : BITFIELD
|
||||
|
||||
(*$R
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue