From 2c9d595da03ae7a95e962cea78e68afff7410cc5 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Wed, 31 Aug 2022 22:19:40 +0200 Subject: [PATCH] Remove useless phantom and pub(crate) --- src/message.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/message.rs b/src/message.rs index 7cf1918..61d01d0 100644 --- a/src/message.rs +++ b/src/message.rs @@ -53,7 +53,6 @@ pub trait Message: Serialize + for<'de> Deserialize<'de> + Send + Sync + 'static /// Req is cheaply clonable to allow the request to be sent to different /// peers (Clone will panic if the stream is a ByteStream). pub struct Req { - pub(crate) _phantom: PhantomData, pub(crate) msg: Arc, pub(crate) msg_ser: Option, pub(crate) stream: AttachedStream, @@ -104,7 +103,6 @@ impl Req { pub(crate) fn from_enc(enc: ReqEnc) -> Result { let msg = rmp_serde::decode::from_read_ref(&enc.msg)?; Ok(Req { - _phantom: Default::default(), msg: Arc::new(msg), msg_ser: Some(enc.msg), stream: enc @@ -124,7 +122,6 @@ impl IntoReq for M { fn into_req(self) -> Result, rmp_serde::encode::Error> { let msg_ser = rmp_to_vec_all_named(&self)?; Ok(Req { - _phantom: Default::default(), msg: Arc::new(self), msg_ser: Some(Bytes::from(msg_ser)), stream: AttachedStream::None, @@ -132,7 +129,6 @@ impl IntoReq for M { } fn into_req_local(self) -> Req { Req { - _phantom: Default::default(), msg: Arc::new(self), msg_ser: None, stream: AttachedStream::None, @@ -159,7 +155,6 @@ impl Clone for Req { } }; Self { - _phantom: Default::default(), msg: self.msg.clone(), msg_ser: self.msg_ser.clone(), stream, @@ -331,7 +326,7 @@ impl ReqEnc { Self::decode_aux(stream).await.map_err(|_| Error::Framing) } - pub(crate) async fn decode_aux(stream: ByteStream) -> Result { + async fn decode_aux(stream: ByteStream) -> Result { let mut reader = ByteStreamReader::new(stream); let prio = reader.read_u8().await?; @@ -415,7 +410,7 @@ impl RespEnc { Self::decode_aux(stream).await.map_err(|_| Error::Framing) } - pub(crate) async fn decode_aux(stream: ByteStream) -> Result { + async fn decode_aux(stream: ByteStream) -> Result { let mut reader = ByteStreamReader::new(stream); let is_err = reader.read_u8().await?;