pub struct ServerConfig { /* private fields */ }Expand description
This struct represents the shared configuration and context for a http server.
This currently contains tunable parameters in a HttpConfig, the Swansong graceful
shutdown control interface, and a shared TypeSet that contains application-specific
information about the running server
Implementations§
Source§impl ServerConfig
impl ServerConfig
Sourcepub fn http_config(&self) -> &HttpConfig
pub fn http_config(&self) -> &HttpConfig
Borrows HttpConfig performance and security parameters
Sourcepub fn http_config_mut(&mut self) -> &mut HttpConfig
pub fn http_config_mut(&mut self) -> &mut HttpConfig
Mutably borrow HttpConfig performance and security parameters
Sourcepub fn set_http_config(&mut self, http_config: HttpConfig) -> &mut Self
pub fn set_http_config(&mut self, http_config: HttpConfig) -> &mut Self
Sets HttpConfig performance and security parameters, returning &mut Self for chaining
Sourcepub fn with_http_config(self, http_config: HttpConfig) -> Self
pub fn with_http_config(self, http_config: HttpConfig) -> Self
Owned chainable setter for HttpConfig performance and security parameters, returning Self
Sourcepub fn swansong_mut(&mut self) -> &mut Swansong
pub fn swansong_mut(&mut self) -> &mut Swansong
Mutably borrow Swansong graceful shutdown interface
Sourcepub fn set_swansong(&mut self, swansong: Swansong) -> &mut Self
pub fn set_swansong(&mut self, swansong: Swansong) -> &mut Self
Sets Swansong graceful shutdown interface, returning &mut Self for chaining
Sourcepub fn with_swansong(self, swansong: Swansong) -> Self
pub fn with_swansong(self, swansong: Swansong) -> Self
Owned chainable setter for Swansong graceful shutdown interface, returning Self
Borrows TypeSet shared state
Mutably borrow TypeSet shared state
Sets TypeSet shared state, returning &mut Self for chaining
Owned chainable setter for TypeSet shared state, returning Self
Source§impl ServerConfig
impl ServerConfig
Sourcepub async fn run<Transport, Handler, Fut>(
self: Arc<Self>,
transport: Transport,
handler: Handler,
) -> Result<Option<Upgrade<Transport>>>
pub async fn run<Transport, Handler, Fut>( self: Arc<Self>, transport: Transport, handler: Handler, ) -> Result<Option<Upgrade<Transport>>>
Perform HTTP on the provided transport, applying the provided async Conn -> Conn handler
function for every distinct http request-response.
For any given invocation of ServerConfig::run, the handler function may run any number of
times, depending on whether the connection is reused by the client.
This can only be called on an Arc<ServerConfig> because an arc clone is moved into the
Conn.
§Errors
This function will return an Error if any of the http requests is
irrecoverably malformed or otherwise noncompliant.
Sourcepub fn shut_down(&self) -> ShutdownCompletion
pub fn shut_down(&self) -> ShutdownCompletion
Attempt graceful shutdown of this server.
The returned ShutdownCompletion type can
either be awaited in an async context or blocked on with ShutdownCompletion::block in a
blocking context