Rust RPC library built on top of [fibers] crate.
Simple echo RPC server: ```rust use fibers::{Executor, InPlaceExecutor, Spawn}; use fibersrpc::{Call, ProcedureId}; use fibersrpc::client::RpcClientServiceBuilder; use fibersrpc::codec::BytesEncoder; use fibersrpc::server::{HandleCall, Reply, RpcServerBuilder}; use futures::Future;
// RPC definition struct EchoRpc; impl Call for EchoRpc { const ID: ProcedureId = ProcedureId(0); const NAME: &'static str = "echo";
type Req = Vec<u8>;
type ReqEncoder = BytesEncoder<Vec<u8>>;
type ReqDecoder = Vec<u8>;
type Res = Vec<u8>;
type ResEncoder = BytesEncoder<Vec<u8>>;
type ResDecoder = Vec<u8>;
}
// Executor let mut executor = InPlaceExecutor::new().unwrap();
// RPC server
struct EchoHandler;
impl HandleCall
// RPC client let service = RpcClientServiceBuilder::new().finish(executor.handle());
let request = Vec::from(&b"hello"[..]); let response = EchoRpc::client(&service.handle()).call(server_addr, request.clone());
executor.spawn(service.maperr(|e| panic!("{}", e))); let result = executor.runfuture(response).unwrap(); assert_eq!(result.ok(), Some(request)); ```