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
module type T_state_bin_io_only = Command_rpc__.Command_rpc_intf.T_state_bin_io_only
module type T_state_conv_bin_io_only = Command_rpc__.Command_rpc_intf.T_state_conv_bin_io_only
module type T_pipe_direct_bin_io_only = Command_rpc__.Command_rpc_intf.T_pipe_direct_bin_io_only
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)
| `Pipe_direct_bin_io_only of (module T_pipe_direct_bin_io_only with type state = 'state)
| `State_bin_io_only of (module T_state_bin_io_only with type state = 'state)
| `State_conv_bin_io_only of (module T_state_conv_bin_io_only with type state = 'state)
]
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.