Add Req::new

This commit is contained in:
Alex 2022-07-22 15:16:50 +02:00
parent cbc21e40ac
commit a0dac87e3b
Signed by untrusted user: lx
GPG key ID: 0E496D15096376BE

View file

@ -60,6 +60,10 @@ pub struct Req<M: Message> {
} }
impl<M: Message> Req<M> { 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 { pub fn with_stream_from_buffer(self, b: Bytes) -> Self {
Self { Self {
stream: AttachedStream::Fixed(b), stream: AttachedStream::Fixed(b),