mirror of https://github.com/fafhrd91/actix-web
fix fix msrv
This commit is contained in:
parent
3433e7711d
commit
4261cab3a5
|
@ -7,7 +7,7 @@ use std::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use bytes::{Bytes, BytesMut};
|
use bytes::{Bytes, BytesMut};
|
||||||
use futures_core::Stream;
|
use futures_core::{ready, Stream};
|
||||||
|
|
||||||
use crate::error::Error;
|
use crate::error::Error;
|
||||||
|
|
||||||
|
@ -72,7 +72,11 @@ impl MessageBody for Body {
|
||||||
Poll::Ready(Some(Ok(mem::take(bin))))
|
Poll::Ready(Some(Ok(mem::take(bin))))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Body::Message(body) => body.as_mut().poll_next(cx).map_err(Into::into),
|
Body::Message(body) => match ready!(body.as_mut().poll_next(cx)) {
|
||||||
|
Some(Err(err)) => Poll::Ready(Some(Err(err.into()))),
|
||||||
|
Some(Ok(val)) => Poll::Ready(Some(Ok(val))),
|
||||||
|
None => Poll::Ready(None),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -212,6 +216,10 @@ impl MessageBody for BoxAnyBody {
|
||||||
mut self: Pin<&mut Self>,
|
mut self: Pin<&mut Self>,
|
||||||
cx: &mut Context<'_>,
|
cx: &mut Context<'_>,
|
||||||
) -> Poll<Option<Result<Bytes, Self::Error>>> {
|
) -> Poll<Option<Result<Bytes, Self::Error>>> {
|
||||||
self.0.as_mut().poll_next(cx).map_err(Into::into)
|
match ready!(self.0.as_mut().poll_next(cx)) {
|
||||||
|
Some(Err(err)) => Poll::Ready(Some(Err(err.into()))),
|
||||||
|
Some(Ok(val)) => Poll::Ready(Some(Ok(val))),
|
||||||
|
None => Poll::Ready(None),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ use std::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use bytes::{Bytes, BytesMut};
|
use bytes::{Bytes, BytesMut};
|
||||||
|
use futures_core::ready;
|
||||||
use pin_project_lite::pin_project;
|
use pin_project_lite::pin_project;
|
||||||
|
|
||||||
use crate::error::Error;
|
use crate::error::Error;
|
||||||
|
@ -212,9 +213,14 @@ where
|
||||||
) -> Poll<Option<Result<Bytes, Self::Error>>> {
|
) -> Poll<Option<Result<Bytes, Self::Error>>> {
|
||||||
let this = self.as_mut().project();
|
let this = self.as_mut().project();
|
||||||
|
|
||||||
this.body.poll_next(cx).map_err(|err| {
|
match ready!(this.body.poll_next(cx)) {
|
||||||
let f = self.as_mut().project().mapper.take().unwrap();
|
Some(Err(err)) => {
|
||||||
(f)(err)
|
let f = self.as_mut().project().mapper.take().unwrap();
|
||||||
})
|
let mapped_err = (f)(err);
|
||||||
|
Poll::Ready(Some(Err(mapped_err)))
|
||||||
|
}
|
||||||
|
Some(Ok(val)) => Poll::Ready(Some(Ok(val))),
|
||||||
|
None => Poll::Ready(None),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,11 @@ impl<B: MessageBody<Error = Error>> MessageBody for EncoderBody<B> {
|
||||||
}
|
}
|
||||||
EncoderBodyProj::Stream(b) => b.poll_next(cx),
|
EncoderBodyProj::Stream(b) => b.poll_next(cx),
|
||||||
EncoderBodyProj::BoxedStream(ref mut b) => {
|
EncoderBodyProj::BoxedStream(ref mut b) => {
|
||||||
b.as_mut().poll_next(cx).map_err(Into::into)
|
match ready!(b.as_mut().poll_next(cx)) {
|
||||||
|
Some(Err(err)) => Poll::Ready(Some(Err(err.into()))),
|
||||||
|
Some(Ok(val)) => Poll::Ready(Some(Ok(val))),
|
||||||
|
None => Poll::Ready(None),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue