fn reconnect(&self) -> impl Future<Item = (), Error = NatsError> {
        *self.state.write() = NatsConnectionState::Reconnecting;

        let inner_arc = Arc::clone(&self.inner);
        let inner_state = Arc::clone(&self.state);
        let is_tls = self.is_tls;
        let maybe_host = self.host.clone();
        NatsConnectionInner::connect_tcp(&self.addr)
            .and_then(move |socket| {
                if is_tls {
                    Either::A(
                        // This unwrap is safe because the value would always be present if `is_tls` is true
                        NatsConnectionInner::upgrade_tcp_to_tls(&maybe_host.unwrap(), socket)
                            .map(NatsConnectionInner::from),
                    )
                } else {
                    Either::B(future::ok(NatsConnectionInner::from(socket)))
                }
            }).and_then(move |inner| {
                {
                    *inner_arc.write() = inner;
                    *inner_state.write() = NatsConnectionState::Connected;
                }
                debug!(target: "nitox", "Successfully swapped reconnected underlying connection");
                Ok(())
            })
    }
/// Tries to reconnect once to the server; Only used internally. Blocks polling during reconnecting
/// by forcing the object to return `Async::NotReady`/`AsyncSink::NotReady`
Tries to reconnect once to the server; Only used internally. Blocks polling during reconnecting
by forcing the object to return `Async::NotReady`/`AsyncSink::NotReady`
Tries to reconnect once to the server ; Only used internally . Blocks polling during reconnecting by forcing the object to return ` Async :: NotReady ` / ` AsyncSink :: NotReady `
fn reconnect(&self) -> impl Future<Item = (), Error = NatsError> {
        *self.state.write() = NatsConnectionState::Reconnecting;
        let inner_arc = Arc::clone(&self.inner);
        let inner_state = Arc::clone(&self.state);
        let is_tls = self.is_tls;
        let maybe_host = self.host.clone();
        NatsConnectionInner::connect_tcp(&self.addr)
            .and_then(move |socket| {
                if is_tls {
                    Either::A(
                        // This unwrap is safe because the value would always be present if `is_tls` is true
                        NatsConnectionInner::upgrade_tcp_to_tls(&maybe_host.unwrap(), socket)
                            .map(NatsConnectionInner::from),
                    )
                } else {
                    Either::B(future::ok(NatsConnectionInner::from(socket)))
                }
            }).and_then(move |inner| {
                {
                    *inner_arc.write() = inner;
                    *inner_state.write() = NatsConnectionState::Connected;
                }
                debug!(target: "nitox", "Successfully swapped reconnected underlying connection");
                Ok(())
            })
    }
fn reconnect ( & self ) -> impl Future < Item = ( ) , Error = NatsError > { * self . state . write ( ) = NatsConnectionState :: Reconnecting ; let inner_arc = Arc :: clone ( & self . inner ) ; let inner_state = Arc :: clone ( & self . state ) ; let is_tls = self . is_tls ; let maybe_host = self . host . clone ( ) ; NatsConnectionInner :: connect_tcp ( & self . addr ) . and_then ( move | socket | { if is_tls { Either :: A ( // This unwrap is safe because the value would always be present if `is_tls` is true NatsConnectionInner :: upgrade_tcp_to_tls ( & maybe_host . unwrap ( ) , socket ) . map ( NatsConnectionInner :: from ) , ) } else { Either :: B ( future :: ok ( NatsConnectionInner :: from ( socket ) ) ) } } ) . and_then ( move | inner | { { * inner_arc . write ( ) = inner ; * inner_state . write ( ) = NatsConnectionState :: Connected ; } debug ! ( target " " " " ) ; Ok ( ( ) ) } ) }
Tries to reconnect once to the server; Only used internally.
Tries to reconnect once to the server ; Only used internally .
&self
&self