[−][src]Struct async_tls::TlsConnector
The TLS connecting part. The acceptor drives the client side of the TLS handshake process. It works on any asynchronous stream.
It provides a simple interface (connect
), returning a future
that will resolve when the handshake process completed. On
success, it will hand you an async TlsStream
.
To create a TlsConnector
with a non-default configuation, create
a rusttls::ClientConfig
and call .into()
on it.
Example
use async_tls::TlsConnector; async_std::task::block_on(async { let connector = TlsConnector::default(); let tcp_stream = async_std::net::TcpStream::connect("example.com").await?; let encrypted_stream = connector.connect("example.com", tcp_stream).await?; Ok(()) as async_std::io::Result<()> });
Implementations
impl TlsConnector
[src]
pub fn new() -> Self
[src]
Create a new TlsConnector with default configuration.
This is the same as calling TlsConnector::default()
.
pub fn connect<'a, IO>(
&self,
domain: impl AsRef<str>,
stream: IO
) -> Connect<IO> where
IO: AsyncRead + AsyncWrite + Unpin,
[src]
&self,
domain: impl AsRef<str>,
stream: IO
) -> Connect<IO> where
IO: AsyncRead + AsyncWrite + Unpin,
Connect to a server. stream
can be any type implementing AsyncRead
and AsyncWrite
,
such as TcpStreams or Unix domain sockets.
The function will return a Connect
Future, representing the connecting part of a Tls
handshake. It will resolve when the handshake is over.
Trait Implementations
impl Clone for TlsConnector
[src]
fn clone(&self) -> TlsConnector
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Default for TlsConnector
[src]
impl From<Arc<ClientConfig>> for TlsConnector
[src]
fn from(inner: Arc<ClientConfig>) -> TlsConnector
[src]
Auto Trait Implementations
impl !RefUnwindSafe for TlsConnector
impl Send for TlsConnector
impl Sync for TlsConnector
impl Unpin for TlsConnector
impl !UnwindSafe for TlsConnector
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,