package capnp-rpc

  1. Overview
  2. Docs
Cap'n Proto is a capability-based RPC system with bindings for many languages

Install

dune-project
 Dependency

Authors

Maintainers

Sources

capnp-rpc-2.1.2.tbz
sha256=ef3f64b22d90bfe87f96e751bc61d29646c970032803c4135bec8626aecf704d
sha512=41731da19a0ec67ae8d519f70ba95bae143493df64133965e9dfd9eb7ca33c745efa6047f8784689be6230a2fefd77649b61635e9b713366e42fd8e89ee07512

doc/capnp-rpc.proto/Capnp_rpc_proto/RC/index.html

Module Capnp_rpc_proto.RCSource

A ref-count type that raises an exception on overflow.

Sourcetype t

A number used as a reference count.

Sourceval zero : t
Sourceval one : t
Sourceval leaked : t

leaked is used to represent a ref-count that is invalid because we detected a GC leak.

Sourceval sum : pp:(Format.formatter -> unit) -> t -> int -> t

sum ~pp t d is t + d. Raises an exception (including pp) if this would overflow or become negative, or if t is zero or leaked.

Sourceval succ : pp:(Format.formatter -> unit) -> t -> t

succ ~pp t is add ~pp t 1.

Sourceval pred : pp:(Format.formatter -> unit) -> t -> t

pred ~pp t is add ~pp t (-1).

Sourceval is_zero : t -> bool

is_zero t is true if the ref-count is zero (the resource should be released). is_zero leaked = false, since whatever detected the leak should free it.

Sourceval pp : t Fmt.t
Sourceval check : pp:(Format.formatter -> unit) -> t -> unit

check ~pp t raises an exception (including pp) if t is zero or leaked. Useful in sanity checks.

Sourceval to_int : t -> int option

to_int t is the non-negative integer ref-count, or None if t = leaked.