pub async fn new<T: Into<Opts>>(opts: T) -> Result<Conn> {
        let opts = opts.into();
        let mut conn = Conn::empty(opts.clone());

        let stream = if let Some(path) = opts.get_socket() {
            Stream::connect_socket(path.to_owned()).await?
        } else {
            Stream::connect_tcp((opts.get_ip_or_hostname(), opts.get_tcp_port())).await?
        };

        conn.inner.stream = Some(stream);
        conn.setup_stream()?
            .handle_handshake()
            .await?
            .switch_to_ssl_if_needed()
            .await?
            .do_handshake_response()
            .await?
            .continue_auth()
            .await?
            .read_socket()
            .await?
            .reconnect_via_socket_if_needed()
            .await?
            .read_max_allowed_packet()
            .await?
            .read_wait_timeout()
            .await?
            .run_init_commands()
            .await
    }
/// Returns future that resolves to `Conn`.
Returns future that resolves to `Conn`.
Returns future that resolves to ` Conn ` .
pub async fn new<T: Into<Opts>>(opts: T) -> Result<Conn> {
        let opts = opts.into();
        let mut conn = Conn::empty(opts.clone());
        let stream = if let Some(path) = opts.get_socket() {
            Stream::connect_socket(path.to_owned()).await?
        } else {
            Stream::connect_tcp((opts.get_ip_or_hostname(), opts.get_tcp_port())).await?
        };
        conn.inner.stream = Some(stream);
        conn.setup_stream()?
            .handle_handshake()
            .await?
            .switch_to_ssl_if_needed()
            .await?
            .do_handshake_response()
            .await?
            .continue_auth()
            .await?
            .read_socket()
            .await?
            .reconnect_via_socket_if_needed()
            .await?
            .read_max_allowed_packet()
            .await?
            .read_wait_timeout()
            .await?
            .run_init_commands()
            .await
    }
pub async fn new < T : Into < Opts > > ( opts : T ) -> Result < Conn > { let opts = opts . into ( ) ; let mut conn = Conn :: empty ( opts . clone ( ) ) ; let stream = if let Some ( path ) = opts . get_socket ( ) { Stream :: connect_socket ( path . to_owned ( ) ) . await ? } else { Stream :: connect_tcp ( ( opts . get_ip_or_hostname ( ) , opts . get_tcp_port ( ) ) ) . await ? } ; conn . inner . stream = Some ( stream ) ; conn . setup_stream ( ) ? . handle_handshake ( ) . await ? . switch_to_ssl_if_needed ( ) . await ? . do_handshake_response ( ) . await ? . continue_auth ( ) . await ? . read_socket ( ) . await ? . reconnect_via_socket_if_needed ( ) . await ? . read_max_allowed_packet ( ) . await ? . read_wait_timeout ( ) . await ? . run_init_commands ( ) . await }
Returns future that resolves to `Conn`.
Returns future that resolves to ` Conn ` .
opts
T
opts
T