pub struct RustlsConnector(/* private fields */);Expand description
A rustls TLS connector ready to perform TLS handshakes.
Wraps an Arc<ClientConfig> and can be built from a RustlsConnectorConfig via
connector_with_no_client_auth or
connector_with_single_cert, or
directly from a ClientConfig via the From impl.
Implementations§
Source§impl RustlsConnector
impl RustlsConnector
Sourcepub fn new_with_webpki_root_certs() -> Result<Self>
pub fn new_with_webpki_root_certs() -> Result<Self>
Sourcepub fn new_with_platform_verifier() -> Result<Self>
pub fn new_with_platform_verifier() -> Result<Self>
Create a new RustlsConnector using the rustls-platform-verifier mechanism (requires platform-verifier feature enabled)
§Errors
Returns an error if we fail to init our verifier
§Panics
Sourcepub fn new_with_native_certs() -> Result<Self>
pub fn new_with_native_certs() -> Result<Self>
Create a new RustlsConnector using the system certs (requires native-certs feature enabled)
§Errors
Returns an error if we fail to load the native certs or to init our verifier.
§Panics
Sourcepub fn connect<S: Read + Write + Send + 'static>(
&self,
domain: &str,
stream: S,
) -> Result<TlsStream<S>, HandshakeError<S>>
pub fn connect<S: Read + Write + Send + 'static>( &self, domain: &str, stream: S, ) -> Result<TlsStream<S>, HandshakeError<S>>
Connect to the given host
§Errors
Returns a HandshakeError containing either the current state of the handshake or the
failure when we couldn’t complete the handshake
Sourcepub async fn connect_async<S: AsyncRead + AsyncWrite + Send + Unpin + 'static>(
&self,
domain: &str,
stream: S,
) -> Result<AsyncTlsStream<S>>
pub async fn connect_async<S: AsyncRead + AsyncWrite + Send + Unpin + 'static>( &self, domain: &str, stream: S, ) -> Result<AsyncTlsStream<S>>
Trait Implementations§
Source§impl Clone for RustlsConnector
impl Clone for RustlsConnector
Source§fn clone(&self) -> RustlsConnector
fn clone(&self) -> RustlsConnector
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 moreSource§impl Debug for RustlsConnector
impl Debug for RustlsConnector
Source§impl From<Arc<ClientConfig>> for RustlsConnector
impl From<Arc<ClientConfig>> for RustlsConnector
Source§fn from(config: Arc<ClientConfig>) -> Self
fn from(config: Arc<ClientConfig>) -> Self
Converts to this type from the input type.
Source§impl From<ClientConfig> for RustlsConnector
impl From<ClientConfig> for RustlsConnector
Source§fn from(config: ClientConfig) -> Self
fn from(config: ClientConfig) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for RustlsConnector
impl !UnwindSafe for RustlsConnector
impl Freeze for RustlsConnector
impl Send for RustlsConnector
impl Sync for RustlsConnector
impl Unpin for RustlsConnector
impl UnsafeUnpin for RustlsConnector
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