protosocket_rpc/lib.rs
1//! Protosocket RPC
2//!
3//! This crate provides an rpc-style client and server for the protosocket
4//! protocol. You can use whatever encoding you want, but you must provide both a
5//! `Serializer` and a `Deserializer` for your messages. If you use `prost`,
6//! you can use the `protosocket-prost` crate to provide these implementations.
7//! See example-proto for an example of how to use this crate with protocol buffers.
8//!
9//! Messages must provide a `Message` implementation, which includes a `message_id`
10//! and a `control_code`. The `message_id` is used to correlate requests and responses,
11//! while the `control_code` is used to provide special handling for messages. You can
12//! receive Cancel when an rpc is aborted, and End when a streaming rpc is complete.
13//!
14//! This RPC client is medium-low level wrapper around the low level protosocket crate,
15//! adding a layer of RPC semantics. You are expected to write a wrapper with the functions
16//! that make sense for your application, and use this client as the transport layer.
17//!
18//! Clients and servers handle RPC cancellation.
19//!
20//! Clients and servers need to agree about the request and response semantics. While it is
21//! supported to have dynamic streaming/unary response types, it is recommended to instead
22//! use separate rpc-initiating messages for streaming and unary rpcs.
23
24mod error;
25mod message;
26
27pub mod client;
28pub mod server;
29
30pub use error::{Error, Result};
31pub use message::{Message, ProtosocketControlCode};