1 | #![deny (missing_docs)] |
2 | #![deny (missing_debug_implementations)] |
3 | #![cfg_attr (test, deny(rust_2018_idioms))] |
4 | #![cfg_attr (all(test, feature = "full" ), deny(unreachable_pub))] |
5 | #![cfg_attr (all(test, feature = "full" ), deny(warnings))] |
6 | #![cfg_attr (all(test, feature = "nightly" ), feature(test))] |
7 | #![cfg_attr (docsrs, feature(doc_cfg))] |
8 | |
9 | //! # hyper |
10 | //! |
11 | //! hyper is a **fast** and **correct** HTTP implementation written in and for Rust. |
12 | //! |
13 | //! ## Features |
14 | //! |
15 | //! - HTTP/1 and HTTP/2 |
16 | //! - Asynchronous design |
17 | //! - Leading in performance |
18 | //! - Tested and **correct** |
19 | //! - Extensive production use |
20 | //! - [Client](client/index.html) and [Server](server/index.html) APIs |
21 | //! |
22 | //! If just starting out, **check out the [Guides](https://hyper.rs/guides/1/) |
23 | //! first.** |
24 | //! |
25 | //! ## "Low-level" |
26 | //! |
27 | //! hyper is a lower-level HTTP library, meant to be a building block |
28 | //! for libraries and applications. |
29 | //! |
30 | //! If looking for just a convenient HTTP client, consider the |
31 | //! [reqwest](https://crates.io/crates/reqwest) crate. |
32 | //! |
33 | //! # Optional Features |
34 | //! |
35 | //! hyper uses a set of [feature flags] to reduce the amount of compiled code. |
36 | //! It is possible to just enable certain features over others. By default, |
37 | //! hyper does not enable any features but allows one to enable a subset for |
38 | //! their use case. Below is a list of the available feature flags. You may |
39 | //! also notice above each function, struct and trait there is listed one or |
40 | //! more feature flags that are required for that item to be used. |
41 | //! |
42 | //! If you are new to hyper it is possible to enable the `full` feature flag |
43 | //! which will enable all public APIs. Beware though that this will pull in |
44 | //! many extra dependencies that you may not need. |
45 | //! |
46 | //! The following optional features are available: |
47 | //! |
48 | //! - `http1`: Enables HTTP/1 support. |
49 | //! - `http2`: Enables HTTP/2 support. |
50 | //! - `client`: Enables the HTTP `client`. |
51 | //! - `server`: Enables the HTTP `server`. |
52 | //! |
53 | //! [feature flags]: https://doc.rust-lang.org/cargo/reference/manifest.html#the-features-section |
54 | //! |
55 | //! ## Unstable Features |
56 | //! |
57 | //! hyper includes a set of unstable optional features that can be enabled through the use of a |
58 | //! feature flag and a [configuration flag]. |
59 | //! |
60 | //! The following is a list of feature flags and their corresponding `RUSTFLAG`: |
61 | //! |
62 | //! - `ffi`: Enables C API for hyper `hyper_unstable_ffi`. |
63 | //! - `tracing`: Enables debug logging with `hyper_unstable_tracing`. |
64 | //! |
65 | //! For example: |
66 | //! |
67 | //! ```notrust |
68 | //! RUSTFLAGS="--cfg hyper_unstable_tracing" cargo build |
69 | //! ``` |
70 | //! |
71 | //! [configuration flag]: https://doc.rust-lang.org/reference/conditional-compilation.html |
72 | //! |
73 | //! # Stability |
74 | //! |
75 | //! It's worth talking a bit about the stability of hyper. hyper's API follows |
76 | //! [SemVer](https://semver.org). Breaking changes will only be introduced in |
77 | //! major versions, if ever. New additions to the API, such as new types, |
78 | //! methods, or traits will only be added in minor versions. |
79 | //! |
80 | //! Some parts of hyper are documented as NOT being part of the stable API. The |
81 | //! following is a brief list, you can read more about each one in the relevant |
82 | //! part of the documentation. |
83 | //! |
84 | //! - Downcasting error types from `Error::source()` is not considered stable. |
85 | //! - Private dependencies use of global variables is not considered stable. |
86 | //! So, if a dependency uses `log` or `tracing`, hyper doesn't promise it |
87 | //! will continue to do so. |
88 | //! - Behavior from default options is not stable. hyper reserves the right to |
89 | //! add new options that are enabled by default which might alter the |
90 | //! behavior, for the purposes of protection. It is also possible to _change_ |
91 | //! what the default options are set to, also in efforts to protect the |
92 | //! most people possible. |
93 | #[doc (hidden)] |
94 | pub use http; |
95 | |
96 | #[cfg (all(test, feature = "nightly" ))] |
97 | extern crate test; |
98 | |
99 | #[doc (no_inline)] |
100 | pub use http::{header, HeaderMap, Method, Request, Response, StatusCode, Uri, Version}; |
101 | |
102 | pub use crate::error::{Error, Result}; |
103 | |
104 | #[macro_use ] |
105 | mod cfg; |
106 | |
107 | #[macro_use ] |
108 | mod trace; |
109 | |
110 | pub mod body; |
111 | mod common; |
112 | mod error; |
113 | pub mod ext; |
114 | #[cfg (test)] |
115 | mod mock; |
116 | pub mod rt; |
117 | pub mod service; |
118 | pub mod upgrade; |
119 | |
120 | #[cfg (feature = "ffi" )] |
121 | #[cfg_attr (docsrs, doc(cfg(all(feature = "ffi" , hyper_unstable_ffi))))] |
122 | pub mod ffi; |
123 | |
124 | cfg_proto! { |
125 | mod headers; |
126 | mod proto; |
127 | } |
128 | |
129 | cfg_feature! { |
130 | #![feature = "client" ] |
131 | |
132 | pub mod client; |
133 | } |
134 | |
135 | cfg_feature! { |
136 | #![feature = "server" ] |
137 | |
138 | pub mod server; |
139 | } |
140 | |