package capnp-rpc-lwt

  1. Overview
  2. Docs

Source file sturdy_ref.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
open Lwt.Infix

class type [+'a] t = Capnp_core.sturdy_ref

let connect t = t#connect

let connect_exn t =
  connect t >>= function
  | Ok x -> Lwt.return x
  | Error e -> Lwt.fail_with (Fmt.to_to_string Capnp_rpc.Exception.pp e)

let reader fn s =
  fn s |> Schema.ReaderOps.string_of_pointer |> Uri.of_string

let builder fn (s : 'a Capnp.BytesMessage.StructStorage.builder_t) (sr : 'a t) =
  sr#to_uri_with_secrets |> Uri.to_string |> Schema.BuilderOps.write_string (fn s)

let cast t = t
OCaml

Innovation. Community. Security.