pub struct Builder<TlsM> { /* private fields */ }Expand description
Server configuration.
Implementations§
Source§impl Builder<NoOpTlsConnectionMiddleware>
impl Builder<NoOpTlsConnectionMiddleware>
Sourcepub fn new(addr: SocketAddr) -> Self
pub fn new(addr: SocketAddr) -> Self
Configure using a socket addr using the Http scheme.
Source§impl<TlsM> Builder<TlsM>
impl<TlsM> Builder<TlsM>
Sourcepub fn with_scheme(self, scheme: Scheme) -> Self
pub fn with_scheme(self, scheme: Scheme) -> Self
Set the scheme used by the the server. A Https scheme requires a TLS config factory.
Sourcepub fn with_connection_middleware(
self,
middleware: ConnectionMiddleware,
) -> Self
pub fn with_connection_middleware( self, middleware: ConnectionMiddleware, ) -> Self
Register a function that acts a connection middleware on any accepted connection. The middleware is able to modify every incoming request.
Sourcepub fn with_tls_config(self, tls: impl Into<TlsConfigFactory>) -> Self
pub fn with_tls_config(self, tls: impl Into<TlsConfigFactory>) -> Self
Register a TlsConfigFactory, which is a function that gets invoked when TLS is enabled.
pub fn with_tls_connection_middleware<T: TlsConnectionMiddleware>( self, middleware: T, ) -> Builder<T>
Sourcepub fn with_cancellation_token(self, cancel: CancellationToken) -> Self
pub fn with_cancellation_token(self, cancel: CancellationToken) -> Self
Register a cancellation token that enables graceful shutdown.
Sourcepub async fn bind(self) -> Result<TowerServer<TlsM>>
pub async fn bind(self) -> Result<TowerServer<TlsM>>
Build server and bind it to the configured address.
Trait Implementations§
Auto Trait Implementations§
impl<TlsM> Freeze for Builder<TlsM>where
TlsM: Freeze,
impl<TlsM> !RefUnwindSafe for Builder<TlsM>
impl<TlsM> Send for Builder<TlsM>where
TlsM: Send,
impl<TlsM> Sync for Builder<TlsM>where
TlsM: Sync,
impl<TlsM> Unpin for Builder<TlsM>where
TlsM: Unpin,
impl<TlsM> !UnwindSafe for Builder<TlsM>
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