Struct TlsConnector
pub struct TlsConnector {
inner: Arc<ClientConfig>,
}Expand description
A wrapper around a rustls::ClientConfig, providing an async connect method.
Fields§
§inner: Arc<ClientConfig>Implementations§
§impl TlsConnector
impl TlsConnector
pub fn connect<IO>(
&self,
domain: ServerName<'static>,
stream: IO,
) -> Connect<IO> ⓘwhere
IO: AsyncRead + AsyncWrite + Unpin,
pub fn connect<IO>(
&self,
domain: ServerName<'static>,
stream: IO,
) -> Connect<IO> ⓘwhere
IO: AsyncRead + AsyncWrite + Unpin,
Returns a future that performs a TLS handshake with domain using the stream.
You likely want to wrap this in a timeout (for example with tokio::time::timeout)
to bound the handshake time.
pub fn connect_with<IO, F>(
&self,
domain: ServerName<'static>,
stream: IO,
f: F,
) -> Connect<IO> ⓘ
pub fn connect_with<IO, F>( &self, domain: ServerName<'static>, stream: IO, f: F, ) -> Connect<IO> ⓘ
Similar to Self::connect(), but calls f before performing the handshake.
As with Self::connect() you likely want to wrap this in a timeout to
bound the handshake time.
The f handler is given a mutable reference to a ClientConnection that can
be used for tasks like writing early data.
pub fn with_alpn( &self, alpn_protocols: Vec<Vec<u8>>, ) -> TlsConnectorWithAlpn<'_>
Trait Implementations§
§impl Clone for TlsConnector
impl Clone for TlsConnector
§fn clone(&self) -> TlsConnector
fn clone(&self) -> TlsConnector
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl From<Arc<ClientConfig>> for TlsConnector
impl From<Arc<ClientConfig>> for TlsConnector
§fn from(inner: Arc<ClientConfig>) -> TlsConnector
fn from(inner: Arc<ClientConfig>) -> TlsConnector
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for TlsConnector
impl !UnwindSafe for TlsConnector
impl Freeze for TlsConnector
impl Send for TlsConnector
impl Sync for TlsConnector
impl Unpin for TlsConnector
impl UnsafeUnpin for TlsConnector
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more