1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//! A general purpose HTTP server based on Hyper and tower-service.

#![doc(html_root_url = "https://docs.rs/tsukuyomi-server/0.1.1")]
#![warn(
    missing_debug_implementations,
    nonstandard_style,
    rust_2018_idioms,
    unused
)]

extern crate bytes;
#[macro_use]
pub extern crate futures;
pub extern crate http;
extern crate hyper;
#[macro_use]
extern crate log;
extern crate tokio;
extern crate tokio_threadpool;
extern crate tower_service;

#[cfg(feature = "tls")]
pub extern crate rustls;
#[cfg(feature = "tls")]
extern crate tokio_rustls;

pub mod local;
pub mod rt;
pub mod server;
pub mod service;

/// A type alias representing a critical error.
pub type CritError = Box<dyn std::error::Error + Send + Sync + 'static>;

pub fn server<S>(new_service: S) -> server::Server<S> {
    server::Server::new(new_service)
}