Struct tls_listener::Builder

source ·
pub struct Builder<T> { /* private fields */ }
Expand description

Builder for TlsListener.

Implementations§

source§

impl<T> Builder<T>

source

pub fn accept_batch_size(&mut self, size: NonZeroUsize) -> &mut Self

Set the size of batches of incoming connections to accept at once

When polling for a new connection, the TlsListener will first check for incomming connections on the listener that need to start a TLS handshake. This specifies the maximum number of connections it will accept before seeing if any TLS connections are ready.

Having a limit for this ensures that ready TLS conections aren’t starved if there are a large number of incoming connections.

Defaults to DEFAULT_ACCEPT_BATCH_SIZE.

source

pub fn handshake_timeout(&mut self, timeout: Duration) -> &mut Self

Set the timeout for handshakes.

If a timeout takes longer than timeout, then the handshake will be aborted and the underlying connection will be dropped.

The default is fairly conservative, to avoid dropping connections. It is recommended that you adjust this to meet the specific needs of your use case in production deployments.

Defaults to DEFAULT_HANDSHAKE_TIMEOUT.

source

pub fn listen<A: AsyncAccept>(&self, listener: A) -> TlsListener<A, T>
where T: AsyncTls<A::Connection>,

Create a TlsListener from the builder

Actually build the TlsListener. The listener argument should be an implementation of the AsyncAccept trait that accepts new connections that the TlsListener will encrypt using TLS.

Trait Implementations§

source§

impl<T: Clone> Clone for Builder<T>

source§

fn clone(&self) -> Builder<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<T> Freeze for Builder<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Builder<T>
where T: RefUnwindSafe,

§

impl<T> Send for Builder<T>
where T: Send,

§

impl<T> Sync for Builder<T>
where T: Sync,

§

impl<T> Unpin for Builder<T>
where T: Unpin,

§

impl<T> UnwindSafe for Builder<T>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.