From e530225520e1232b68bc841b11902ad589cfb831 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Tue, 30 Nov 2021 01:07:40 +0000 Subject: [PATCH] internal docs --- actix-tls/src/connect/connector.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/actix-tls/src/connect/connector.rs b/actix-tls/src/connect/connector.rs index f5717661..bde9a23a 100644 --- a/actix-tls/src/connect/connector.rs +++ b/actix-tls/src/connect/connector.rs @@ -78,14 +78,14 @@ impl Service> for ConnectorService { } } -/// Helper enum to generic over futures of resolve and connect steps. +/// Chains futures of resolve and connect steps. pub(crate) enum ConnectFut { Resolve(>>::Future), Connect(>>::Future), } -/// Helper enum to contain the future output of `ConnectFuture`. -pub(crate) enum ConnectOutput { +/// Container for the intermediate states of [`ConnectFut`]. +pub(crate) enum ConnectFutState { Resolved(ConnectInfo), Connected(Connection), } @@ -94,13 +94,14 @@ impl ConnectFut { fn poll_connect( &mut self, cx: &mut Context<'_>, - ) -> Poll, ConnectError>> { + ) -> Poll, ConnectError>> { match self { ConnectFut::Resolve(ref mut fut) => { - Pin::new(fut).poll(cx).map_ok(ConnectOutput::Resolved) + Pin::new(fut).poll(cx).map_ok(ConnectFutState::Resolved) } + ConnectFut::Connect(ref mut fut) => { - Pin::new(fut).poll(cx).map_ok(ConnectOutput::Connected) + Pin::new(fut).poll(cx).map_ok(ConnectFutState::Connected) } } } @@ -117,10 +118,10 @@ impl Future for ConnectServiceResponse { fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { loop { match ready!(self.fut.poll_connect(cx))? { - ConnectOutput::Resolved(res) => { + ConnectFutState::Resolved(res) => { self.fut = ConnectFut::Connect(self.tcp.call(res)); } - ConnectOutput::Connected(res) => return Poll::Ready(Ok(res)), + ConnectFutState::Connected(res) => return Poll::Ready(Ok(res)), } } }