Trait tls_api::TlsConnector
source · [−]pub trait TlsConnector: Sized + Sync + Send + 'static {
type Builder: TlsConnectorBuilder<Connector = Self>;
type Underlying;
type TlsStream: TlsStreamDyn;
const IMPLEMENTED: bool;
const SUPPORTS_ALPN: bool;
const TYPE_DYN: &'static dyn TlsConnectorType = &TlsConnectorTypeImpl::(marker::PhantomData);
fn underlying_mut(&mut self) -> &mut Self::Underlying;
fn info() -> ImplInfo;
fn builder() -> Result<Self::Builder>;
fn connect_with_socket<'a, S>(
&'a self,
domain: &'a str,
stream: S
) -> BoxFuture<'a, Result<TlsStreamWithSocket<S>>>ⓘNotable traits for BoxFuture<'a, R>impl<'a, R> Future for BoxFuture<'a, R> type Output = R;
where
S: AsyncSocket;
fn connect_impl_tls_stream<'a, S>(
&'a self,
domain: &'a str,
stream: S
) -> BoxFuture<'a, Result<Self::TlsStream>>ⓘNotable traits for BoxFuture<'a, R>impl<'a, R> Future for BoxFuture<'a, R> type Output = R;
where
S: AsyncSocket;
fn into_dyn(self) -> TlsConnectorBox { ... }
fn connect_default<'a, S>(
domain: &'a str,
stream: S
) -> BoxFuture<'a, Result<TlsStream>>ⓘNotable traits for BoxFuture<'a, R>impl<'a, R> Future for BoxFuture<'a, R> type Output = R;
where
S: AsyncSocket,
{ ... }
fn connect<'a, S>(
&'a self,
domain: &'a str,
stream: S
) -> BoxFuture<'a, Result<TlsStream>>ⓘNotable traits for BoxFuture<'a, R>impl<'a, R> Future for BoxFuture<'a, R> type Output = R;
where
S: AsyncSocket,
{ ... }
}
Expand description
A builder for client-side TLS connections.
Required Associated Types
type Builder: TlsConnectorBuilder<Connector = Self>
type Builder: TlsConnectorBuilder<Connector = Self>
Type of the builder for this connector.
type Underlying
type Underlying
Type of the underlying connector.
type TlsStream: TlsStreamDyn
type TlsStream: TlsStreamDyn
crate::TlsStream<tls_api::AsyncSocketBox>
.
In the world of HKT this would be:
type TlsStream<S: TlsStreamDyn> : TlsStreamWithSocketDyn<S>;
Required Associated Constants
const IMPLEMENTED: bool
const IMPLEMENTED: bool
Is it implemented? When false
all operations return an error.
At the moment of writing, there are two crates which return false
here:
tls-api-stub
, dummy implementation is not meant to be instantiatedtls-api-security-framework
,true
only on macOS and iOS,false
elsewhere
const SUPPORTS_ALPN: bool
const SUPPORTS_ALPN: bool
Whether this implementation supports ALPN negotiation.
Provided Associated Constants
const TYPE_DYN: &'static dyn TlsConnectorType = &TlsConnectorTypeImpl::(marker::PhantomData)
const TYPE_DYN: &'static dyn TlsConnectorType = &TlsConnectorTypeImpl::(marker::PhantomData)
Dynamic (without type parameter) version of the connector.
This function returns a connector type, which can be used to constructor connectors.
Required Methods
fn underlying_mut(&mut self) -> &mut Self::Underlying
fn underlying_mut(&mut self) -> &mut Self::Underlying
Get the underlying builder.
API intentionally exposes the underlying acceptor builder to allow fine tuning not possible in common API.
fn connect_with_socket<'a, S>(
&'a self,
domain: &'a str,
stream: S
) -> BoxFuture<'a, Result<TlsStreamWithSocket<S>>>ⓘNotable traits for BoxFuture<'a, R>impl<'a, R> Future for BoxFuture<'a, R> type Output = R;
where
S: AsyncSocket,
fn connect_with_socket<'a, S>(
&'a self,
domain: &'a str,
stream: S
) -> BoxFuture<'a, Result<TlsStreamWithSocket<S>>>ⓘNotable traits for BoxFuture<'a, R>impl<'a, R> Future for BoxFuture<'a, R> type Output = R;
where
S: AsyncSocket,
Connect.
Returned future is resolved when the TLS-negotiation completes, and the stream is ready to send and receive.
This function returns a stream which provides access to the underlying socket.
Practically, connect
is usually needed.
Connect.
Returned future is resolved when the TLS-negotiation completes, and the stream is ready to send and receive.
This version returns a stream of type of the underlying implementation, which may provide access to the implementation details.
Practically, connect
is usually needed.
Provided Methods
fn into_dyn(self) -> TlsConnectorBox
fn into_dyn(self) -> TlsConnectorBox
Dynamic (without type parameter) version of the connector.
Connect using default settings.
Shortcut.
Connect.
Returned future is resolved when the TLS-negotiation completes, and the stream is ready to send and receive.
This is like the function you want to use.