[][src]Struct tide_rustls::TlsListenerBuilder

pub struct TlsListenerBuilder { /* fields omitted */ }

A builder for TlsListeners

This is created with a call to TlsListener::build. This also can be passed directly to tide::Server::listen, skipping the TlsListenerBuilder::finish call.

Examples

let listener = TlsListener::build()
    .addrs("localhost:4433")
    .cert("./tls/localhost-4433.cert")
    .key("./tls/localhost-4433.key")
    .finish();
let listener = TlsListener::build()
    .tcp(std::net::TcpListener::bind("localhost:4433").unwrap())
    .config(rustls::ServerConfig::new(rustls::NoClientAuth::new()))
    .finish();

Implementations

impl TlsListenerBuilder[src]

pub fn key(self, path: impl AsRef<Path>) -> Self[src]

Provide a path to a key file, in either pkcs8 or rsa formats. This is mutually exclusive with providing a server config with TlsListenerBuilder::config, but must be used in conjunction with TlsListenerBuilder::cert

pub fn cert(self, path: impl AsRef<Path>) -> Self[src]

Provide a path to a cert file. This is mutually exclusive with providing a server config with TlsListenerBuilder::config, but must be used in conjunction with TlsListenerBuilder::key

pub fn config(self, config: ServerConfig) -> Self[src]

Provide a prebuilt rustls::ServerConfig with any options. This is mutually exclusive with both TlsListenerBuilder::key and TlsListenerBuilder::cert, but provides the opportunity for more configuration choices.

pub fn tcp(self, tcp: impl Into<TcpListener>) -> Self[src]

Provides a bound tcp listener (either async-std or std) to build this tls listener on. This is mutually exclusive with TlsListenerBuilder::addrs, but one of them is mandatory.

pub fn addrs(self, addrs: impl ToSocketAddrs) -> Self[src]

Provides a std::net::ToSocketAddrs specification for this tls listener. This is mutually exclusive with TlsListenerBuilder::tcp but one of them is mandatory.

pub fn finish(self) -> Result<TlsListener>[src]

finishes building a TlsListener from this TlsListenerBuilder.

Errors

this will return an error unless all of the following conditions are met:

Trait Implementations

impl Debug for TlsListenerBuilder[src]

impl Default for TlsListenerBuilder[src]

impl<State: Clone + Send + Sync + 'static> ToListener<State> for TlsListenerBuilder[src]

type Listener = TlsListener

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Sealed<T> for T where
    T: ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,