https://github.com/msgpack/msgpack-ocaml
MessagePack implementation for OCaml / msgpack.org[OCaml]
https://github.com/msgpack/msgpack-ocaml
Last synced: 10 months ago
JSON representation
MessagePack implementation for OCaml / msgpack.org[OCaml]
- Host: GitHub
- URL: https://github.com/msgpack/msgpack-ocaml
- Owner: msgpack
- Created: 2012-07-04T03:10:03.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2022-10-12T14:54:27.000Z (over 3 years ago)
- Last Synced: 2025-03-22T16:45:19.661Z (10 months ago)
- Language: OCaml
- Homepage:
- Size: 288 KB
- Stars: 45
- Watchers: 6
- Forks: 19
- Open Issues: 5
-
Metadata Files:
- Readme: README.markdown
- Changelog: Changelog.md
Awesome Lists containing this project
README
MsgPack for OCaml
==============================
BULID
------------
``` bash
$ make
$ sudo make install
```
EXAMPLE
------------
### Serialize/Deserialize for Msgpack Object
``` ocaml
(* serialize *)
let bytes =
Msgpack.Serialize.serialize_string (`FixArray [`PFixnum 1; `PFixnum 2; `PFixnum 3])
(* deserialize *)
let obj =
Msgpack.Serialize.deserialize_string bytes
```
### Serialize/Deserialize for OCaml types (with meta_conv)
``` ocaml
open Msgpack_conv
type t = {
int : int;
str : string;
} with conv(msgpack)
(* serialize *)
let bytes =
Msgpack.Serialize.serialize_string (msgpack_of_t { int = 42; str = "ans" })
(* deserialize *)
let obj =
t_of_msgpack (Msgpack.Serialize.deserialize_string bytes)
```
See also, `examlpe/`
DEVELOPMENT
------------
Setup development enviroment with docker:
```sh
$ docker-compose build
$ docker-compose run app
```
TEST
------------
``` bash
$ ocaml setup.ml -configure --enable-tests
$ make test
```
PROOF
-----------
If you want to use msgpack at OCaml, you need not do this section.
This section for user intrested in formal verification.
You need Coq 8.4 and omake.
``` bash
$ cd proof
$ make
$ cp *.ml* ../lib/core
```