diff options
author | Ferris Tseng <ferris@navapbc.com> | 2019-12-24 13:08:56 -0500 |
---|---|---|
committer | Ferris Tseng <ferris@navapbc.com> | 2019-12-24 13:08:56 -0500 |
commit | 3d61a5f9c12962a3b62ee851905afdf980368a22 (patch) | |
tree | 7edd5b86effef20b247b97c1c7d0d9bbb0b67f1f /ipfs-api/src/lib.rs | |
parent | cef3df9cd1958315dcc5cc4264a82e2574310330 (diff) |
move types to lib
Diffstat (limited to 'ipfs-api/src/lib.rs')
-rw-r--r-- | ipfs-api/src/lib.rs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/ipfs-api/src/lib.rs b/ipfs-api/src/lib.rs index 3c638de..27cf2bf 100644 --- a/ipfs-api/src/lib.rs +++ b/ipfs-api/src/lib.rs @@ -168,3 +168,35 @@ mod header; mod read; mod request; pub mod response; + +#[cfg(feature = "actix")] +use actix_http::{encoding, Payload, PayloadStream}; +use futures::Stream; +#[cfg(feature = "hyper")] +use hyper::{self, client::HttpConnector}; +#[cfg(feature = "hyper")] +use hyper_tls::HttpsConnector; +use response::Error; + +/// A future that returns a stream of responses. +/// +#[cfg(feature = "actix")] +pub(crate) type AsyncStreamResponse<T> = Box<dyn Stream<Item = Result<T, Error>> + Unpin + 'static>; +#[cfg(feature = "hyper")] +pub(crate) type AsyncStreamResponse<T> = + Box<dyn Stream<Item = Result<T, Error>> + Unpin + Send + 'static>; + +#[cfg(feature = "actix")] +pub(crate) type Request = awc::ClientRequest; +#[cfg(feature = "hyper")] +pub(crate) type Request = http::Request<hyper::Body>; + +#[cfg(feature = "actix")] +pub(crate) type Response = awc::ClientResponse<encoding::Decoder<Payload<PayloadStream>>>; +#[cfg(feature = "hyper")] +pub(crate) type Response = http::Response<hyper::Body>; + +#[cfg(feature = "actix")] +pub(crate) type Client = awc::Client; +#[cfg(feature = "hyper")] +pub(crate) type Client = hyper::client::Client<HttpsConnector<HttpConnector>, hyper::Body>; |