package ocamlformat-rpc-lib

  1. Overview
  2. Docs

OCamlformat RPC API.

This module defines the commands exchanged between the server and the client, and the way to build RPC clients.

The whole API is functorized over an IO module defining the blocking interface for reading and writing the data.

After you decided on the IO implementation, the Ocamlformat_rpc_lib.Make API can then be instantiated:

module RPC = Ocamlformat_rpc_lib.Make (IO)
type format_args = {
  1. path : string option;
    (*

    Path used for the current formatting request, this allows ocamlformat to determine which .ocamlformat files must be applied.

    *)
  2. config : (string * string) list option;
    (*

    Additional options used for the current formatting request.

    *)
}
val empty_args : format_args
module Version : sig ... end
module type IO = sig ... end

Defines the blocking interface for reading and writing to Cohttp streams

module Make (IO : IO) : sig ... end

For a basic working example, see: test/rpc/rpc_test.ml.

Disclaimer:

The ocamlformat-rpc-lib API is versioned to offer some basic backwards compatibility. Note that this guarantee is "best effort", meaning the authors will try to minimize the changes over time and preserve the original behavior or versioned clients as much as possible. However structural changes may happen.

OCaml

Innovation. Community. Security.