1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-06-26 19:47:43 +02:00

cleanup Unpin constraint; simplify Framed impl

This commit is contained in:
Nikolay Kim
2019-11-19 14:51:40 +06:00
parent 617e40a7e9
commit 3bf83c1d98
30 changed files with 493 additions and 1252 deletions

View File

@ -40,9 +40,7 @@ impl<T: AsyncRead + AsyncWrite, P> Clone for OpensslAcceptor<T, P> {
}
}
impl<T: AsyncRead + AsyncWrite + Unpin + 'static, P: Unpin> ServiceFactory
for OpensslAcceptor<T, P>
{
impl<T: AsyncRead + AsyncWrite + Unpin + 'static, P> ServiceFactory for OpensslAcceptor<T, P> {
type Request = Io<T, P>;
type Response = Io<SslStream<T>, P>;
type Error = HandshakeError<T>;
@ -70,9 +68,7 @@ pub struct OpensslAcceptorService<T, P> {
io: PhantomData<(T, P)>,
}
impl<T: AsyncRead + AsyncWrite + Unpin + 'static, P: Unpin> Service
for OpensslAcceptorService<T, P>
{
impl<T: AsyncRead + AsyncWrite + Unpin + 'static, P> Service for OpensslAcceptorService<T, P> {
type Request = Io<T, P>;
type Response = Io<SslStream<T>, P>;
type Error = HandshakeError<T>;
@ -103,7 +99,6 @@ impl<T: AsyncRead + AsyncWrite + Unpin + 'static, P: Unpin> Service
pub struct OpensslAcceptorServiceFut<T, P>
where
P: Unpin,
T: AsyncRead + AsyncWrite,
{
fut: LocalBoxFuture<'static, Result<SslStream<T>, HandshakeError<T>>>,
@ -111,7 +106,9 @@ where
_guard: CounterGuard,
}
impl<T: AsyncRead + AsyncWrite, P: Unpin> Future for OpensslAcceptorServiceFut<T, P> {
impl<T: AsyncRead + AsyncWrite + Unpin, P> Unpin for OpensslAcceptorServiceFut<T, P> {}
impl<T: AsyncRead + AsyncWrite + Unpin, P> Future for OpensslAcceptorServiceFut<T, P> {
type Output = Result<Io<SslStream<T>, P>, HandshakeError<T>>;
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {

View File

@ -42,7 +42,7 @@ impl<T, P> Clone for RustlsAcceptor<T, P> {
}
}
impl<T: AsyncRead + AsyncWrite + Unpin, P: Unpin> ServiceFactory for RustlsAcceptor<T, P> {
impl<T: AsyncRead + AsyncWrite + Unpin, P> ServiceFactory for RustlsAcceptor<T, P> {
type Request = Io<T, P>;
type Response = Io<TlsStream<T>, P>;
type Error = io::Error;
@ -71,7 +71,7 @@ pub struct RustlsAcceptorService<T, P> {
conns: Counter,
}
impl<T: AsyncRead + AsyncWrite + Unpin, P: Unpin> Service for RustlsAcceptorService<T, P> {
impl<T: AsyncRead + AsyncWrite + Unpin, P> Service for RustlsAcceptorService<T, P> {
type Request = Io<T, P>;
type Response = Io<TlsStream<T>, P>;
type Error = io::Error;
@ -98,14 +98,15 @@ impl<T: AsyncRead + AsyncWrite + Unpin, P: Unpin> Service for RustlsAcceptorServ
pub struct RustlsAcceptorServiceFut<T, P>
where
T: AsyncRead + AsyncWrite + Unpin,
P: Unpin,
{
fut: Accept<T>,
params: Option<P>,
_guard: CounterGuard,
}
impl<T: AsyncRead + AsyncWrite + Unpin, P: Unpin> Future for RustlsAcceptorServiceFut<T, P> {
impl<T: AsyncRead + AsyncWrite + Unpin, P> Unpin for RustlsAcceptorServiceFut<T, P> {}
impl<T: AsyncRead + AsyncWrite + Unpin, P> Future for RustlsAcceptorServiceFut<T, P> {
type Output = Result<Io<TlsStream<T>, P>, io::Error>;
fn poll(self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {