aboutsummaryrefslogtreecommitdiff
path: root/src/client.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-07-21 19:05:51 +0200
committerAlex Auvolat <alex@adnab.me>2022-07-21 19:05:51 +0200
commit44bbc1c00c2532e08dff0d4a547b0a707e89f32d (patch)
treea6c021ae50370b3c065e3485ef1dd06052a962c9 /src/client.rs
parent26989bba1409bfc093e58ef98e75885b10ad7c1c (diff)
downloadnetapp-44bbc1c00c2532e08dff0d4a547b0a707e89f32d.tar.gz
netapp-44bbc1c00c2532e08dff0d4a547b0a707e89f32d.zip
Rename AutoSerialize into SimpleMessage and refactor a bit
Diffstat (limited to 'src/client.rs')
-rw-r--r--src/client.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/client.rs b/src/client.rs
index 663a3e4..cf80746 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -134,15 +134,14 @@ impl ClientConn {
self.query_send.store(None);
}
- pub(crate) async fn call<T, B>(
+ pub(crate) async fn call<T>(
self: Arc<Self>,
- rq: B,
+ rq: T,
path: &str,
prio: RequestPriority,
) -> Result<<T as Message>::Response, Error>
where
T: Message,
- B: Borrow<T>,
{
let query_send = self.query_send.load_full().ok_or(Error::ConnectionClosed)?;
@@ -164,7 +163,8 @@ impl ClientConn {
};
// Encode request
- let (body, stream) = rmp_to_vec_all_named(rq.borrow())?;
+ let (rq, stream) = rq.into_parts();
+ let body = rmp_to_vec_all_named(&rq)?;
drop(rq);
let request = QueryMessage {
@@ -217,7 +217,7 @@ impl ClientConn {
let code = resp[0];
if code == 0 {
let ser_resp = rmp_serde::decode::from_read_ref(&resp[1..])?;
- Ok(T::Response::deserialize_msg(ser_resp, stream).await)
+ Ok(T::Response::from_parts(ser_resp, stream))
} else {
let msg = String::from_utf8(resp[1..].to_vec()).unwrap_or_default();
Err(Error::Remote(code, msg))