Cstruct.4.0.0: sexplib goes optional

A headsup about a forthcoming backwards incompatible change to the cstruct 4.0.0 release. We’ve been reducing the required dependencies of the core Mirage libraries to make the ‘hello world’ unikernels as small as possible. As part of that, cstruct (along with its good friends ipaddr and uri) have moved sexplib into a separate optional module.

From the changes file:

  • Sexplib is now an optional library for the base Cstruct module.
    A new Cstruct_sexp module has been introduced with the serialiser
    functions, contained within the cstruct-sexp opam package.

    To convert old code, simply use Cstruct_sexp.t instead of
    Cstruct.t in a record type for which you are using [@@deriving sexp].
    This is a type alias to Cstruct.t but also has the right
    sexp-conversion functions in scope. There is an example of this
    in the ppx_test/with-sexp directory in the source repo.

    When you have converted and released your library, add an
    opam constraint of cstruct {>="4.0.0"} to your own opam
    packages to ensure that they pick up this version of the library.

The opam repository PR with the full changeset is at : https://github.com/ocaml/opam-repository/pull/13748

5 Likes