[][src]Struct fibers_http_server::ServerBuilder

pub struct ServerBuilder { /* fields omitted */ }

HTTP server builder.

Methods

impl ServerBuilder[src]

pub fn new(bind_addr: SocketAddr) -> Self[src]

Makes a new ServerBuilder instance.

pub fn add_handler<H>(&mut self, handler: H) -> Result<&mut Self> where
    H: HandleRequest,
    H::Decoder: Default,
    H::Encoder: Default
[src]

Adds a HTTP request handler.

Errors

If the path and method of the handler conflicts with the already registered handlers, an ErrorKind::InvalidInput error will be returned.

pub fn add_handler_with_options<H, D, E>(
    &mut self,
    handler: H,
    options: HandlerOptions<H, D, E>
) -> Result<&mut Self> where
    H: HandleRequest,
    D: Factory<Item = H::Decoder> + Send + Sync + 'static,
    E: Factory<Item = H::Encoder> + Send + Sync + 'static, 
[src]

Adds a HTTP request handler with the given options.

Errors

If the path and method of the handler conflicts with the already registered handlers, an ErrorKind::InvalidInput error will be returned.

pub fn logger(&mut self, logger: Logger) -> &mut Self[src]

Sets the logger of the server.

The default value is Logger::root(Discard, o!()).

pub fn metrics(&mut self, metrics: MetricBuilder) -> &mut Self[src]

Sets MetricBuilder used by the server.

The default value is MetricBuilder::default().

pub fn read_buffer_size(&mut self, n: usize) -> &mut Self[src]

Sets the application level read buffer size of the server in bytes.

The default value is 8192.

pub fn write_buffer_size(&mut self, n: usize) -> &mut Self[src]

Sets the application level write buffer size of the server in bytes.

The default value is 8192.

pub fn decode_options(&mut self, options: DecodeOptions) -> &mut Self[src]

Sets the options of the request decoder of the server.

The default value is DecodeOptions::default().

pub fn finish<S>(self, spawner: S) -> Server where
    S: Spawn + Send + 'static, 
[src]

Builds a HTTP server with the given settings.

Trait Implementations

impl Debug for ServerBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]