[−][src]Struct fibers_http_server::ServerBuilder
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]
H: HandleRequest,
H::Decoder: Default,
H::Encoder: Default,
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]
&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,
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]
S: Spawn + Send + 'static,
Builds a HTTP server with the given settings.
Trait Implementations
Auto Trait Implementations
impl Send for ServerBuilder
impl !Sync for ServerBuilder
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,