#macro #rpc #traits #transport #parameters #magic #essrpc

macro essrpc_macros

Macros for ESSRPC. Do not use this crate directly -- use the essrpc crate.

4 releases (breaking)

0.4.0 Oct 1, 2021
0.3.0 Dec 31, 2019
0.2.0 Feb 16, 2019
0.1.0 Dec 5, 2018

#61 in #magic


Used in 2 crates (via essrpc)

MIT license

15KB
342 lines

Latest Version docs

Electron's Super Simple RPC (ESSRPC)

ESSRPC is a lightweight RPC library for Rust which aims to enable RPC calls as transparently as possible through calls to ordinary trait methods.

  • Allows ordinary calls to trait methods to call an implementation across an RPC boundary (in another process, across the network, etc)
  • Is agnostic to the underlying transport used.
  • Uses only stable Rust.

The magic is performed by the essrpc attribute macro which may be applied to any trait whose functions each meet the following conditions:

  • Returns a Result whose error type implements From<RPCError>.
  • Uses only parameter and returns types which implement Serialize
  • Is not unsafe

Please see the documentation for examples and more details.

Status

Alpha. Things are expected to work, but only a small amount of real world usage has occurred.

Configurable Features

  • async_client: Enables asynchronous clients
  • bincode_transport: Enables BincodeTransport
  • json_transport: Enables JSONTransport
  • wasm_bindgen: Enables wasm-bindgen compatibility. Specifically, UUID generation in the JSON transport uses wasm-bindgen compatible randomness.

Inspirations and Motivations

ESSRPC was inspired by tarpc and by the build_rpc_trait! macro from jsonrpc. Both of these are more mature projects. The recent stabilization of procedural macros allows ESSRPC to generate an RPC client/server pair from a more natural trait defintion. ESSRPC also makes fewer assumptions about the underlying RPC transport.

Dependencies

~1.5MB
~35K SLoC