/rust/registry/src/index.crates.io-1949cf8c6b5b557f/hyper-1.8.1/src/body/mod.rs
Line | Count | Source |
1 | | //! Streaming bodies for Requests and Responses |
2 | | //! |
3 | | //! For both [Clients](crate::client) and [Servers](crate::server), requests and |
4 | | //! responses use streaming bodies, instead of complete buffering. This |
5 | | //! allows applications to not use memory they don't need, and allows exerting |
6 | | //! back-pressure on connections by only reading when asked. |
7 | | //! |
8 | | //! There are two pieces to this in hyper: |
9 | | //! |
10 | | //! - **The [`Body`] trait** describes all possible bodies. |
11 | | //! hyper allows any body type that implements `Body`, allowing |
12 | | //! applications to have fine-grained control over their streaming. |
13 | | //! - **The [`Incoming`] concrete type**, which is an implementation |
14 | | //! of `Body`, and returned by hyper as a "receive stream" (so, for server |
15 | | //! requests and client responses). |
16 | | //! |
17 | | //! There are additional implementations available in [`http-body-util`][], |
18 | | //! such as a `Full` or `Empty` body. |
19 | | //! |
20 | | //! [`http-body-util`]: https://docs.rs/http-body-util |
21 | | |
22 | | pub use bytes::{Buf, Bytes}; |
23 | | pub use http_body::Body; |
24 | | pub use http_body::Frame; |
25 | | pub use http_body::SizeHint; |
26 | | |
27 | | pub use self::incoming::Incoming; |
28 | | |
29 | | #[cfg(all(any(feature = "client", feature = "server"), feature = "http1"))] |
30 | | pub(crate) use self::incoming::Sender; |
31 | | #[cfg(all( |
32 | | any(feature = "http1", feature = "http2"), |
33 | | any(feature = "client", feature = "server") |
34 | | ))] |
35 | | pub(crate) use self::length::DecodedLength; |
36 | | |
37 | | mod incoming; |
38 | | #[cfg(all( |
39 | | any(feature = "http1", feature = "http2"), |
40 | | any(feature = "client", feature = "server") |
41 | | ))] |
42 | | mod length; |
43 | | |
44 | 0 | fn _assert_send_sync() { |
45 | 0 | fn _assert_send<T: Send>() {} |
46 | 0 | fn _assert_sync<T: Sync>() {} |
47 | | |
48 | 0 | _assert_send::<Incoming>(); |
49 | 0 | _assert_sync::<Incoming>(); |
50 | 0 | } |