aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-07-22 15:16:50 +0200
committerAlex Auvolat <alex@adnab.me>2022-07-22 15:16:50 +0200
commita0dac87e3b8b749afa63b5707eefeb676e23b622 (patch)
tree30571b0824e4cb2dc5c3be1b302aca3d801206a2
parentcbc21e40acfc420a3e452a1fd488c6a96694b0f2 (diff)
downloadnetapp-a0dac87e3b8b749afa63b5707eefeb676e23b622.tar.gz
netapp-a0dac87e3b8b749afa63b5707eefeb676e23b622.zip
Add Req::new
-rw-r--r--src/message.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/message.rs b/src/message.rs
index ff9861c..7cf1918 100644
--- a/src/message.rs
+++ b/src/message.rs
@@ -60,6 +60,10 @@ pub struct Req<M: Message> {
}
impl<M: Message> Req<M> {
+ pub fn new(v: M) -> Result<Self, Error> {
+ Ok(v.into_req()?)
+ }
+
pub fn with_stream_from_buffer(self, b: Bytes) -> Self {
Self {
stream: AttachedStream::Fixed(b),