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:
- Implement the
Connectiontrait - Create a
Serverwith the service - Call
server.tcp(addr)orserver.unix(path) - Call
server.run()
To implement a client:
- Implement the
Connectiontrait - Create a
ClientviaClient::connect_tcp(addr, service)orClient::connect_unix(path, service) - Use
client.send_request()orclient.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.
- Request
Handle - 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.
- Server
Handle - A handle for controlling a running server.
- Service
Error - 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.
- Protocol
Error - 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.
- Connection
Maker - A trait for creating connections.
- Listener
- A listener that yields bidirectional streams.
Functions§
- duplex
- Create a pair of connected in-memory streams.