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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
#![deny(warnings, clippy::all, missing_debug_implementations)] #![allow(clippy::needless_doctest_main, clippy::unknown_clippy_lints)] // using the tokio::main attribute //! A wrapper for integrating `hyper 0.13` with a `conduit 0.8` blocking application stack. //! //! A `conduit::Handler` is allowed to block so the `Server` must be spawned on the (default) //! multi-threaded `Runtime` which allows (by default) 100 concurrent blocking threads. Any excess //! requests will asynchronously await for an available blocking thread. //! //! # Examples //! //! Try out the example with `cargo run --example server`. //! //! Typical usage: //! //! ```no_run //! use conduit::Handler; //! use conduit_hyper::Server; //! use futures::executor::block_on; //! use tokio::runtime::Runtime; //! //! #[tokio::main] //! async fn main() { //! let app = build_conduit_handler(); //! let addr = ([127, 0, 0, 1], 12345).into(); //! let server = Server::bind(&addr, app); //! //! server.await; //! } //! //! fn build_conduit_handler() -> impl Handler { //! // ... //! # Endpoint() //! } //! # //! # use std::{error, io}; //! # use conduit::{Request, Response}; //! # //! # struct Endpoint(); //! # impl Handler for Endpoint { //! # fn call(&self, _: &mut dyn Request) -> Result<Response, Box<dyn error::Error + Send>> { //! # Ok(Response { //! # status: (200, "OK"), //! # headers: Default::default(), //! # body: Box::new(io::Cursor::new("")), //! # }) //! # } //! # } //! ``` mod adaptor; mod server; mod service; #[cfg(test)] mod tests; // Consumers of this library need access to this particular version of `semver` pub use semver; pub use server::Server; pub use service::Service;