pub struct ServerBuilder<T>(/* private fields */);
Available on
rustls
only.Expand description
Helper to construct an Endpoint
for use with incoming connections.
To get one, call new_with_xxx
methods.
Implementations§
Source§impl ServerBuilder<ServerConfig>
impl ServerBuilder<ServerConfig>
Sourcepub fn new_with_rustls_server_config(server_config: ServerConfig) -> Self
pub fn new_with_rustls_server_config(server_config: ServerConfig) -> Self
Create a builder with the provided rustls::ServerConfig
.
Sourcepub fn new_with_single_cert(
cert_chain: Vec<CertificateDer<'static>>,
key_der: PrivateKeyDer<'static>,
) -> Result<Self, Error>
pub fn new_with_single_cert( cert_chain: Vec<CertificateDer<'static>>, key_der: PrivateKeyDer<'static>, ) -> Result<Self, Error>
Create a builder with a single certificate chain and matching private
key. Using this method gets the same result as calling
ServerConfig::with_single_cert
.
Sourcepub fn with_alpn_protocols(self, protocols: &[&str]) -> Self
pub fn with_alpn_protocols(self, protocols: &[&str]) -> Self
Set the ALPN protocols to use.
Sourcepub fn with_key_log(self) -> Self
pub fn with_key_log(self) -> Self
Logging key material to a file for debugging. The file’s name is given
by the SSLKEYLOGFILE
environment variable.
If SSLKEYLOGFILE
is not set, or such a file cannot be opened or cannot
be written, this does nothing.
Sourcepub fn build(self) -> ServerConfig
pub fn build(self) -> ServerConfig
Build a ServerConfig
.
Sourcepub async fn bind(self, addr: impl ToSocketAddrsAsync) -> Result<Endpoint>
pub async fn bind(self, addr: impl ToSocketAddrsAsync) -> Result<Endpoint>
Create a new Endpoint
.
See Endpoint::server
for more information.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for ServerBuilder<T>where
T: Freeze,
impl<T> RefUnwindSafe for ServerBuilder<T>where
T: RefUnwindSafe,
impl<T> Send for ServerBuilder<T>where
T: Send,
impl<T> Sync for ServerBuilder<T>where
T: Sync,
impl<T> Unpin for ServerBuilder<T>where
T: Unpin,
impl<T> UnwindSafe for ServerBuilder<T>where
T: UnwindSafe,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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