rama_hyper/
lib.rs

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//! - `ffi`: Enables C API for hyper `hyper_unstable_ffi`.
62//! - `tracing`: Enables debug logging with `hyper_unstable_tracing`.
63//!
64//! Enabling an unstable feature is possible with the following `cargo` command, as of version `1.64.0`:
65//! ```notrust
66//! RUSTFLAGS="--cfg hyper_unstable_tracing" cargo rustc --features client,http1,http2,tracing --crate-type cdylib
67//!```
68//! [configuration flag]: https://doc.rust-lang.org/reference/conditional-compilation.html
69//!
70//! # Stability
71//!
72//! It's worth talking a bit about the stability of hyper. hyper's API follows
73//! [SemVer](https://semver.org). Breaking changes will only be introduced in
74//! major versions, if ever. New additions to the API, such as new types,
75//! methods, or traits will only be added in minor versions.
76//!
77//! Some parts of hyper are documented as NOT being part of the stable API. The
78//! following is a brief list, you can read more about each one in the relevant
79//! part of the documentation.
80//!
81//! - Downcasting error types from `Error::source()` is not considered stable.
82//! - Private dependencies use of global variables is not considered stable.
83//!   So, if a dependency uses `log` or `tracing`, hyper doesn't promise it
84//!   will continue to do so.
85//! - Behavior from default options is not stable. hyper reserves the right to
86//!   add new options that are enabled by default which might alter the
87//!   behavior, for the purposes of protection. It is also possible to _change_
88//!   what the default options are set to, also in efforts to protect the
89//!   most people possible.
90#[doc(hidden)]
91pub use http;
92
93#[cfg(all(test, feature = "nightly"))]
94extern crate test;
95
96pub use crate::http::{header, Method, Request, Response, StatusCode, Uri, Version};
97
98#[doc(no_inline)]
99pub use crate::http::HeaderMap;
100
101pub use crate::error::{Error, Result};
102
103#[macro_use]
104mod cfg;
105
106#[macro_use]
107mod trace;
108
109#[macro_use]
110mod common;
111pub mod body;
112mod error;
113pub mod ext;
114#[cfg(test)]
115mod mock;
116pub mod rt;
117pub mod service;
118pub mod upgrade;
119
120#[cfg(feature = "ffi")]
121#[cfg_attr(docsrs, doc(cfg(all(feature = "ffi", hyper_unstable_ffi))))]
122pub mod ffi;
123
124cfg_proto! {
125    mod headers;
126    mod proto;
127}
128
129cfg_feature! {
130    #![feature = "client"]
131
132    pub mod client;
133}
134
135cfg_feature! {
136    #![feature = "server"]
137
138    pub mod server;
139}