Skip to main content

Crate mrpc

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, service) or Client::connect_unix(path, service)
  3. Use client.send_request() or client.send_notification()

Structs§

Client
RPC client for connecting to a server over TCP or Unix domain sockets.
Notification
An RPC notification message containing a method name and parameters.
Request
An RPC request message containing an ID, method name, and parameters.
RequestHandle
Handle to an in-flight RPC request.
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.
ServerHandle
A handle for controlling a running server.
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.
ProtocolError
Errors indicating a violation of the MessagePack-RPC protocol or message framing.
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.
Listener
A listener that yields bidirectional streams.

Functions§

duplex
Create a pair of connected in-memory streams.

Type Aliases§

Result
A type alias for Result with RpcError as the error type.