finchers_runtime/
lib.rs

1//! Runtime support for Finchers, which supports serving asynchronous HTTP services.
2
3#![doc(html_root_url = "https://docs.rs/finchers-runtime/0.11.0")]
4#![deny(missing_docs)]
5#![deny(missing_debug_implementations)]
6#![deny(warnings)]
7
8extern crate finchers_core;
9
10extern crate bytes;
11#[macro_use]
12extern crate futures;
13extern crate http;
14extern crate hyper;
15#[macro_use]
16extern crate structopt;
17extern crate failure;
18#[macro_use]
19extern crate scoped_tls;
20extern crate tokio;
21
22#[macro_use]
23extern crate slog;
24extern crate slog_async;
25extern crate slog_term;
26
27pub mod endpoint;
28pub mod server;
29pub mod service;
30
31pub use server::{Config, Server};
32pub use service::{HttpService, NewHttpService};
33
34use finchers_core::{Endpoint, Responder};
35
36/// Start the server with given endpoint and default configuration.
37pub fn run<E>(endpoint: E)
38where
39    E: Endpoint + 'static,
40    E::Output: Responder,
41{
42    let config = Config::from_env();
43    let new_service = endpoint::NewEndpointService::new(endpoint);
44    Server::new(new_service, config).launch();
45}