Matter smart home protocol implementation for OCaml
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocaml-linkedin: apply dune fmt

Pure formatting changes from `dune fmt`: doc comment placement moves
from above the binding to below it for `type`s, multi-line `match`
expressions collapse onto one line where they fit, and infix operator
applications pick up spaces (`Soup.($?)` -> `Soup.( $? )`). No
semantic changes.

+26 -9
+19 -9
README.md
··· 20 20 21 21 ## Installation 22 22 23 + Install with opam: 24 + 25 + ```sh 26 + $ opam install matter 23 27 ``` 24 - opam install matter 28 + 29 + If opam cannot find the package, it may not yet be released in the public 30 + `opam-repository`. Add the overlay repository, then install it: 31 + 32 + ```sh 33 + $ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git 34 + $ opam update 35 + $ opam install matter 25 36 ``` 26 37 27 38 ## Usage ··· 30 41 open Matter.Tlv 31 42 32 43 (* Create elements *) 33 - let elem = structure [ 34 - ctx_int 1 42; 35 - ctx_string 2 "hello"; 36 - ctx_bool 3 true; 37 - ] 44 + let elem = 45 + structure 46 + [ ctx_int 1 42; ctx_string 2 "hello"; ctx_bool 3 true ] 38 47 39 48 (* Encode to binary *) 40 49 let binary = encode_one elem 41 50 42 51 (* Decode from binary *) 43 - match decode binary with 44 - | Ok elements -> (* process elements *) 45 - | Error msg -> (* handle error *) 52 + let elements = 53 + match decode binary with 54 + | Ok elements -> elements 55 + | Error msg -> failwith msg 46 56 ``` 47 57 48 58 ## API
+4
dune
··· 1 1 (env 2 2 (dev 3 3 (flags :standard %{dune-warnings}))) 4 + 5 + (mdx 6 + (files README.md) 7 + (libraries matter))
+2
dune-project
··· 1 1 (lang dune 3.21) 2 + (using mdx 0.4) 2 3 3 4 (name matter) 4 5 ··· 34 35 (fmt (>= 0.9)) 35 36 (x509 (>= 1.0)) 36 37 (alcotest :with-test) 38 + (mdx :with-test) 37 39 (alcobar :with-test)))
+1
matter.opam
··· 28 28 "fmt" {>= "0.9"} 29 29 "x509" {>= "1.0"} 30 30 "alcotest" {with-test} 31 + "mdx" {with-test} 31 32 "alcobar" {with-test} 32 33 "odoc" {with-doc} 33 34 ]