Struct http_srv::server::config::ServerConfig

source ·
pub struct ServerConfig {
    pub port: u16,
    pub n_workers: u16,
    pub keep_alive_timeout: Duration,
    pub keep_alive_requests: u16,
}

Fields§

§port: u16§n_workers: u16§keep_alive_timeout: Duration§keep_alive_requests: u16

Implementations§

source§

impl ServerConfig

crate::HttpServer configuration

§Example

use http_srv::server::ServerConfig;

let mut conf =
ServerConfig::default()
    .port(8080)
    .n_workers(1024);
source

pub fn parse<I>(args: I) -> Self
where I: Iterator<Item = String>,

Parse the configuration from the command line args

source

pub fn keep_alive(&self) -> bool

source

pub fn n_workers(self, n_workers: u16) -> Self

source

pub fn port(self, port: u16) -> Self

source

pub fn keep_alive_timeout(self, timeout: Duration) -> Self

source

pub fn keep_alive_requests(self, n: u16) -> Self

Trait Implementations§

source§

impl Clone for ServerConfig

source§

fn clone(&self) -> ServerConfig

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Default for ServerConfig

source§

fn default() -> Self

Default configuration

  • Port: 80
  • Nº Workers: 1024
  • Keep Alive Timeout: 0s (Disabled)
  • Keep Alove Requests: 10000
source§

impl Copy for ServerConfig

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.