Crate mrpc

Source
Expand description

MessagePack-RPC implementation in Rust.

Provides asynchronous RPC servers and clients over TCP and Unix domain sockets. Implements the full MessagePack-RPC specification.

Both servers and clients can handle incoming RPC messages, enabling bidirectional communication.

To implement a server:

  1. Implement the Connection trait
  2. Create a Server with the service
  3. Call server.tcp(addr) or server.unix(path)
  4. Call server.run()

To implement a client:

  1. Implement the Connection trait
  2. Create a Client via Client::connect_tcp(addr) or Client::connect_unix(path)
  3. Use client.send_request() or client.send_notification()

Structs§

Client
RPC client for connecting to a server over TCP or Unix domain sockets.
ConnectionMakerFn
Notification
An RPC notification message containing a method name and parameters.
Request
An RPC request message containing an ID, method name, and parameters.
Response
An RPC response message containing an ID and either a result or an error.
RpcSender
The interface for sending RPC requests and notifications.
Server
RPC server that can listen on TCP or Unix domain sockets. The service type must implement the RpcService trait and Default. A new service instance is created for each connection.
ServiceError
An error that occurred during the execution of an RPC service method.

Enums§

Message
Represents the different types of RPC messages: requests, responses, and notifications.
RpcError
Errors that can occur during RPC operations.
Value
Represents any valid MessagePack value.

Traits§

Connection
A single Connection in an RPC server or client. For server connections, a new instance of the Connection is created for each incoming connection. For clients, a single instance is used for the lifetime of the connection.
ConnectionMaker
A trait for creating connections.

Type Aliases§

Result