nyquest_interface/
async.rs

1//! Asynchronous HTTP client interface.
2//!
3//! This module provides the interfaces and types necessary for asynchronous
4//! HTTP client implementations in nyquest.
5
6mod any;
7mod backend;
8
9pub use any::{AnyAsyncBackend, AnyAsyncClient, AnyAsyncResponse};
10pub use backend::{AsyncBackend, AsyncClient, AsyncResponse};
11/// Type alias for asynchronous HTTP requests.
12pub type Request = crate::Request<BoxedStream>;
13
14cfg_if::cfg_if! {
15    if #[cfg(feature = "async-stream")] {
16        use futures_io::AsyncRead as MaybeAsyncRead;
17
18        mod body;
19
20        pub use body::{Body, BoxedStream, SizedBodyStream, UnsizedBodyStream};
21        pub use futures_io;
22    } else {
23        /// Placeholder trait when async stream functionality is not required.
24        pub trait MaybeAsyncRead {}
25        impl<T: ?Sized> MaybeAsyncRead for T {}
26
27        type BoxedStream = std::convert::Infallible;
28        /// Type alias for common HTTP request bodies.
29        pub type Body = crate::body::Body<std::convert::Infallible>;
30    }
31}