pub struct TlsConnector(/* private fields */);tls only.Expand description
A wrapper around a native_tls::TlsConnector or rustls::ClientConfig,
providing an async connect method.
Implementations§
Source§impl TlsConnector
impl TlsConnector
Sourcepub async fn connect<S>(
&self,
domain: &str,
stream: S,
) -> Result<TlsStream<S>, Error>where
S: Splittable + 'static,
<S as Splittable>::ReadHalf: AsyncRead + Unpin,
<S as Splittable>::WriteHalf: AsyncWrite + Unpin,
pub async fn connect<S>(
&self,
domain: &str,
stream: S,
) -> Result<TlsStream<S>, Error>where
S: Splittable + 'static,
<S as Splittable>::ReadHalf: AsyncRead + Unpin,
<S as Splittable>::WriteHalf: AsyncWrite + Unpin,
Connects the provided stream with this connector, assuming the provided domain.
This function will internally call TlsConnector::connect to connect
the stream and returns a future representing the resolution of the
connection operation. The returned future will resolve to either
TlsStream<S> or Error depending if it’s successful or not.
This is typically used for clients who have already established, for example, a TCP connection to a remote server. That stream is then provided here to perform the client half of a connection to a TLS-powered server.
Sourcepub async fn connect_compat<S>(
&self,
domain: &str,
stream: AsyncStream<S>,
) -> Result<TlsStream<S>, Error>where
S: Splittable + 'static,
<S as Splittable>::ReadHalf: AsyncRead + Unpin,
<S as Splittable>::WriteHalf: AsyncWrite + Unpin,
pub async fn connect_compat<S>(
&self,
domain: &str,
stream: AsyncStream<S>,
) -> Result<TlsStream<S>, Error>where
S: Splittable + 'static,
<S as Splittable>::ReadHalf: AsyncRead + Unpin,
<S as Splittable>::WriteHalf: AsyncWrite + Unpin,
Similar to connect but accepts an AsyncStream instead of a raw
stream. Users are free to adjust the inner buffer sizes and limits.
Trait Implementations§
Source§impl Clone for TlsConnector
impl Clone for TlsConnector
Source§fn clone(&self) -> TlsConnector
fn clone(&self) -> TlsConnector
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TlsConnector
impl Debug for TlsConnector
Source§impl From<Arc<ClientConfig>> for TlsConnector
Available on crate feature rustls only.
impl From<Arc<ClientConfig>> for TlsConnector
rustls only.Source§fn from(value: Arc<ClientConfig>) -> TlsConnector
fn from(value: Arc<ClientConfig>) -> TlsConnector
Source§impl From<TlsConnector> for TlsConnector
Available on crate feature native-tls only.
impl From<TlsConnector> for TlsConnector
native-tls only.Source§fn from(value: TlsConnector) -> TlsConnector
fn from(value: TlsConnector) -> TlsConnector
Auto Trait Implementations§
impl Freeze for TlsConnector
impl !RefUnwindSafe for TlsConnector
impl !Send for TlsConnector
impl !Sync for TlsConnector
impl Unpin for TlsConnector
impl UnsafeUnpin for TlsConnector
impl !UnwindSafe 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more