[−][src]Crate urpc
uRPC (pronounced micro RPC) is a simple and lightweight RPC framework designed with embedded
systems in mind. The server side works in a heapless environment with no_std
and is
supposed to use very low resources. The current client side implementation requires std
.
Features
- ✓ Support for 256 different methods.
- ✓ Low level primitives for the server side regarding request parsing and reply serializing.
- ✓ Single argument of any
sedre::Serialize + serde::DeserializeOwned
type. - ✓ Optional byte buffer for the argument that doesn't involve any buffer copy.
- This feature is designed to optimize the transfer of bytes between client and server minimizing the amount of used memory in the server.
- ✓ Single return value of any
sedre::Serialize + serde::DeserializeOwned
type. - ✓ Optional byte buffer for the reply ~~that doesn't involve any buffer copy~~.
- This feature is designed to optimize the transfer of bytes between client and server ~~minimizing the amount of used memory in the client~~.
- ✗ Methods can return custom errors.
- ✗ Asyncrhonous methods.
- ✗ Support for holding 255 async uncompleted requests.
- ✗ Stream methods.
Packet format
- The request packet consists of a 7 byte header, an optional body and an optional byte buffer.
- The reply packet consists of a 6 byte header, an optional body and an optional byte buffer.
Header Format
Request
length | desc |
---|---|
8b | method index |
8b | channel id |
8b | options |
16b | body length (little endian) |
16b | optional buffer length (little endian) |
Reply
length | desc |
---|---|
8b | channel id |
8b | options |
16b | body length (little endian) |
16b | optional buffer length (little endian) |
Usage
The best way to use this library is by using the macros server_requets
and client_requests
.
You can see complete examples in the documentation: server_requests,
client_requests.
Modules
client | Client side implementation |
consts | Constant parameters |
server | Server side implementation |
Macros
client_requests | Macro that builds the required types to make calls via RPC from the client. |
rpc_client_io | |
rpc_client_io_fn | |
server_requests | |
server_requests_variant | Macro that builds the required types to handle calls via RPC from the server. |
Structs
OptBufNo | Indicate that the RPC Call doesn't contain an optional buffer. |
OptBufYes | Indicate that the RPC Call contains an optional buffer. |
Opts | Options of a request/reply packet |
ReplyHeader | Header of a reply packet |
RequestHeader | Header of a request packet |
Traits
OptBuf | Trait used to allow building RPC calls with optional buffer. |