pub struct ServerConfig { /* private fields */ }Expand description
Advanced server configuration.
Implementations§
Source§impl ServerConfig
impl ServerConfig
Sourcepub fn processors(&self) -> usize
pub fn processors(&self) -> usize
Returns the number of processors the server is allocated.
This is only used to derive default values for other settings in this type.
Defaults to the number of logical CPUs.
Sourcepub fn min_threads(&self) -> usize
pub fn min_threads(&self) -> usize
Returns the minimum number of threads in the pool used to process blocking endpoints.
Defaults to 8 times the number of processors.
Sourcepub fn max_threads(&self) -> usize
pub fn max_threads(&self) -> usize
Returns the maximum number of threads in the pool used to process blocking endpoints.
Defaults to the maximum of 32 times the number of processors and 256.
Sourcepub fn max_connections(&self) -> usize
pub fn max_connections(&self) -> usize
Returns the maximum number of live TCP connections the server will allow at any time.
Defaults to 10 times the value of Self::max_threads.
Sourcepub fn io_threads(&self) -> usize
pub fn io_threads(&self) -> usize
Returns the number of threads used for nonblocking operations in the server’s Tokio runtime.
Defaults to half the number of processors.
Sourcepub fn idle_thread_timeout(&self) -> Duration
pub fn idle_thread_timeout(&self) -> Duration
Returns the amount of time a thread in the blocking request pool will sit idle before shutting down.
Defaults to 5 minutes.
Sourcepub fn shutdown_timeout(&self) -> Duration
pub fn shutdown_timeout(&self) -> Duration
Returns the amount of time the server will wait for pending requests to complete when shutting down.
Defaults to 15 seconds.
Sourcepub fn gzip(&self) -> bool
pub fn gzip(&self) -> bool
Determines if responses larger than 1 MiB will be compressed with gzip.
Defaults to true.
Sourcepub fn http2(&self) -> bool
pub fn http2(&self) -> bool
Determines if the server will support the HTTP2 protocol.
Defaults to false.
Sourcepub fn idle_connection_timeout(&self) -> Option<Duration>
pub fn idle_connection_timeout(&self) -> Option<Duration>
Returns the amount of time the server allows TCP connections to remain idle before shutting them down.
If None, defaults to 1 minute. If Some, the time will be included in HTTP responses in a Keep-Alive
header.
Trait Implementations§
Source§impl Clone for ServerConfig
impl Clone for ServerConfig
Source§fn clone(&self) -> ServerConfig
fn clone(&self) -> ServerConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ServerConfig
impl Debug for ServerConfig
Source§impl Default for ServerConfig
impl Default for ServerConfig
Source§fn default() -> ServerConfig
fn default() -> ServerConfig
Source§impl<'de> Deserialize<'de> for ServerConfig
impl<'de> Deserialize<'de> for ServerConfig
Source§fn deserialize<D>(
deserializer: D,
) -> Result<ServerConfig, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<ServerConfig, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl PartialEq for ServerConfig
impl PartialEq for ServerConfig
impl StructuralPartialEq for ServerConfig
Auto Trait Implementations§
impl Freeze for ServerConfig
impl RefUnwindSafe for ServerConfig
impl Send for ServerConfig
impl Sync for ServerConfig
impl Unpin for ServerConfig
impl UnwindSafe for ServerConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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