Module Command.Stateful

module type T = Command_rpc__.Command_rpc_intf.T
module type T_conv = Command_rpc__.Command_rpc_intf.T_conv
module type T_pipe = Command_rpc__.Command_rpc_intf.T_pipe
module type T_pipe_conv = Command_rpc__.Command_rpc_intf.T_pipe_conv
type 'state t = [
| `Plain of (module T with type state = 'state)
| `Plain_conv of (module T_conv with type state = 'state)
| `Pipe of (module T_pipe with type state = 'state)
| `Pipe_conv of (module T_pipe_conv with type state = 'state)
| `Implementations of 'state Async.Rpc.Implementation.t list
]
val lift : 'a t -> f:('b -> 'a) -> 'b t

Given an RPC that expects a state type 'a, it can use a state type 'b if we tell it how to extract an 'a from it. Note that this extraction is done on every RPC call, so should be cheap and should not copy mutable state that you want to persist across calls.