fn connect_with<'a, IO, F>(
        &self,
        domain: impl AsRef<str>,
        stream: IO,
        f: F,
    ) -> io::Result<Connect<IO>>
    where
        IO: AsyncRead + AsyncWrite + Unpin,
        F: FnOnce(&mut ClientSession),
    {
        let domain = DNSNameRef::try_from_ascii_str(domain.as_ref())
            .map_err(|_| io::Error::new(io::ErrorKind::InvalidInput, "invalid domain"))?;
        let mut session = ClientSession::new(&self.inner, domain);
        f(&mut session);

        #[cfg(not(feature = "early-data"))]
        {
            Ok(Connect(client::MidHandshake::Handshaking(
                client::TlsStream {
                    session,
                    io: stream,
                    state: TlsState::Stream,
                },
            )))
        }

        #[cfg(feature = "early-data")]
        {
            Ok(Connect(if self.early_data {
                client::MidHandshake::EarlyData(client::TlsStream {
                    session,
                    io: stream,
                    state: TlsState::EarlyData,
                    early_data: (0, Vec::new()),
                })
            } else {
                client::MidHandshake::Handshaking(client::TlsStream {
                    session,
                    io: stream,
                    state: TlsState::Stream,
                    early_data: (0, Vec::new()),
                })
            }))
        }
    }
// NOTE: Currently private, exposing ClientSession exposes rusttls
// Early data should be exposed differently
Currently private, exposing ClientSession exposes rusttls
Early data should be exposed differently
Currently private exposing ClientSession exposes rusttls Early data should be exposed differently
fn connect_with<'a, IO, F>(
        &self,
        domain: impl AsRef<str>,
        stream: IO,
        f: F,
    ) -> io::Result<Connect<IO>>
    where
        IO: AsyncRead + AsyncWrite + Unpin,
        F: FnOnce(&mut ClientSession),
    {
        let domain = DNSNameRef::try_from_ascii_str(domain.as_ref())
            .map_err(|_| io::Error::new(io::ErrorKind::InvalidInput, "invalid domain"))?;
        let mut session = ClientSession::new(&self.inner, domain);
        f(&mut session);
        #[cfg(not(feature = "early-data"))]
        {
            Ok(Connect(client::MidHandshake::Handshaking(
                client::TlsStream {
                    session,
                    io: stream,
                    state: TlsState::Stream,
                },
            )))
        }
        #[cfg(feature = "early-data")]
        {
            Ok(Connect(if self.early_data {
                client::MidHandshake::EarlyData(client::TlsStream {
                    session,
                    io: stream,
                    state: TlsState::EarlyData,
                    early_data: (0, Vec::new()),
                })
            } else {
                client::MidHandshake::Handshaking(client::TlsStream {
                    session,
                    io: stream,
                    state: TlsState::Stream,
                    early_data: (0, Vec::new()),
                })
            }))
        }
    }
fn connect_with < ' a , IO , F > ( & self , domain : impl AsRef < str > , stream : IO , f : F , ) -> io :: Result < Connect < IO > > where IO : AsyncRead + AsyncWrite + Unpin , F : FnOnce ( & mut ClientSession ) , { let domain = DNSNameRef :: try_from_ascii_str ( domain . as_ref ( ) ) . map_err ( | _ | io :: Error :: new ( io :: ErrorKind :: InvalidInput , " " ) ) ? ; let mut session = ClientSession :: new ( & self . inner , domain ) ; f ( & mut session ) ; # [ cfg ( not ( feature " " ) ) ] { Ok ( Connect ( client :: MidHandshake :: Handshaking ( client :: TlsStream { session , io : stream , state : TlsState :: Stream , } , ) ) ) } # [ cfg ( feature " " ) ] { Ok ( Connect ( if self . early_data { client :: MidHandshake :: EarlyData ( client :: TlsStream { session , io : stream , state : TlsState :: EarlyData , early_data : ( 0 , Vec :: new ( ) ) , } ) } else { client :: MidHandshake :: Handshaking ( client :: TlsStream { session , io : stream , state : TlsState :: Stream , early_data : ( 0 , Vec :: new ( ) ) , } ) } ) ) } }
NOTE: Currently private, exposing ClientSession exposes rusttls
Early data should be exposed differently
NOTE : Currently private exposing ClientSession exposes rusttls Early data should be exposed differently
&self
domain
impl AsRef<str>
stream
IO
f
F
&self
domain
impl AsRef<str>
stream
IO
f
F