aboutsummaryrefslogtreecommitdiff
path: root/src/client.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/client.rs')
-rw-r--r--src/client.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/client.rs b/src/client.rs
index 9d572aa..c878627 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -135,10 +135,10 @@ impl ClientConn {
pub(crate) async fn call<T>(
self: Arc<Self>,
- rq: T,
+ req: Req<T>,
path: &str,
prio: RequestPriority,
- ) -> Result<<T as Message>::Response, Error>
+ ) -> Result<Resp<T>, Error>
where
T: Message,
{
@@ -162,9 +162,8 @@ impl ClientConn {
};
// Encode request
- let (rq, stream) = rq.into_parts();
- let body = rmp_to_vec_all_named(&rq)?;
- drop(rq);
+ let body = req.msg_ser.unwrap().clone();
+ let stream = req.body.into_stream();
let request = QueryMessage {
prio,
@@ -216,7 +215,11 @@ impl ClientConn {
let code = resp[0];
if code == 0 {
let ser_resp = rmp_serde::decode::from_read_ref(&resp[1..])?;
- Ok(T::Response::from_parts(ser_resp, stream))
+ Ok(Resp {
+ _phantom: Default::default(),
+ msg: ser_resp,
+ body: BodyData::Stream(stream),
+ })
} else {
let msg = String::from_utf8(resp[1..].to_vec()).unwrap_or_default();
Err(Error::Remote(code, msg))