diff --git a/src/message.rs b/src/message.rs index 0ac4cb8..8e4bc2f 100644 --- a/src/message.rs +++ b/src/message.rs @@ -63,10 +63,6 @@ pub struct Req { } impl Req { - pub fn msg(&self) -> &M { - &self.msg - } - pub fn with_fixed_body(self, b: Bytes) -> Self { Self { body: BodyData::Fixed(b), @@ -81,6 +77,10 @@ impl Req { } } + pub fn msg(&self) -> &M { + &self.msg + } + pub fn take_stream(&mut self) -> Option { std::mem::replace(&mut self.body, BodyData::None).into_stream() } @@ -216,6 +216,10 @@ impl Resp { self.msg } + pub fn into_parts(self) -> (M::Response, Option) { + (self.msg, self.body.into_stream()) + } + pub(crate) fn into_enc(self) -> Result { Ok(RespEnc::Success { msg: rmp_to_vec_all_named(&self.msg)?.into(),