fn connect_status(connect_result: std::io::Result<TcpStream>) -> ConnectStatus {
        if let Ok(stream) = connect_result {
            return ConnectStatus::Success(stream);
        }
        match connect_result.as_ref().err().unwrap().raw_os_error() {
            Some(err_code) => match nix::errno::from_i32(err_code) {
                nix::errno::Errno::ECONNREFUSED => ConnectStatus::ServerDown,
                nix::errno::Errno::EHOSTUNREACH => ConnectStatus::ServerDown,
                _ => ConnectStatus::Error(nix::errno::from_i32(err_code)),
            },
            _ => ConnectStatus::Error(nix::errno::Errno::EINTR),
        }
    }
/// Parses the `connect()` result and returns the status
Parses the `connect()` result and returns the status
Parses the ` connect () ` result and returns the status
fn connect_status(connect_result: std::io::Result<TcpStream>) -> ConnectStatus {
        if let Ok(stream) = connect_result {
            return ConnectStatus::Success(stream);
        }
        match connect_result.as_ref().err().unwrap().raw_os_error() {
            Some(err_code) => match nix::errno::from_i32(err_code) {
                nix::errno::Errno::ECONNREFUSED => ConnectStatus::ServerDown,
                nix::errno::Errno::EHOSTUNREACH => ConnectStatus::ServerDown,
                _ => ConnectStatus::Error(nix::errno::from_i32(err_code)),
            },
            _ => ConnectStatus::Error(nix::errno::Errno::EINTR),
        }
    }
fn connect_status ( connect_result : std :: io :: Result < TcpStream > ) -> ConnectStatus { if let Ok ( stream ) = connect_result { return ConnectStatus :: Success ( stream ) ; } match connect_result . as_ref ( ) . err ( ) . unwrap ( ) . raw_os_error ( ) { Some ( err_code ) => match nix :: errno :: from_i32 ( err_code ) { nix :: errno :: Errno :: ECONNREFUSED => ConnectStatus :: ServerDown , nix :: errno :: Errno :: EHOSTUNREACH => ConnectStatus :: ServerDown , _ => ConnectStatus :: Error ( nix :: errno :: from_i32 ( err_code ) ) , } , _ => ConnectStatus :: Error ( nix :: errno :: Errno :: EINTR ) , } }
Parses the `connect()` result and returns the status
Parses the ` connect () ` result and returns the status
connect_result
std::io::Result<TcpStream>
connect_result
std::io::Result<TcpStream>