rspotify_http/
lib.rs

1//! The HTTP client may vary depending on which one the user configures. This
2//! module contains the required logic to use different clients interchangeably.
3
4// Disable all modules when both client features are enabled or when none are.
5// This way only the compile error below gets shown instead of a whole list of
6// confusing errors..
7
8#[cfg(feature = "client-reqwest")]
9#[cfg(not(all(feature = "client-reqwest", feature = "client-ureq")))]
10mod reqwest;
11
12#[cfg(feature = "client-ureq")]
13#[cfg(not(all(feature = "client-reqwest", feature = "client-ureq")))]
14mod ureq;
15
16#[cfg(any(feature = "client-reqwest", feature = "client-ureq"))]
17#[cfg(not(all(feature = "client-reqwest", feature = "client-ureq")))]
18mod common;
19
20#[cfg(all(feature = "reqwest-middleware", feature = "client-reqwest"))]
21#[cfg(not(all(feature = "client-reqwest", feature = "client-ureq")))]
22pub use self::reqwest::{Middleware, ReqwestClientBuilder as HttpClientBuilder};
23#[cfg(feature = "client-reqwest")]
24#[cfg(not(all(feature = "client-reqwest", feature = "client-ureq")))]
25pub use self::reqwest::{ReqwestClient as HttpClient, ReqwestError as HttpError};
26
27#[cfg(feature = "client-ureq")]
28#[cfg(not(all(feature = "client-reqwest", feature = "client-ureq")))]
29pub use self::ureq::{UreqClient as HttpClient, UreqError as HttpError};
30
31#[cfg(any(feature = "client-reqwest", feature = "client-ureq"))]
32#[cfg(not(all(feature = "client-reqwest", feature = "client-ureq")))]
33pub use common::{BaseHttpClient, Form, Headers, Query};
34
35#[cfg(all(feature = "client-reqwest", feature = "client-ureq"))]
36compile_error!(
37    "`client-reqwest` and `client-ureq` features cannot both be enabled at \
38    the same time, if you want to use `client-ureq` you need to set \
39    `default-features = false`"
40);
41
42#[cfg(not(any(feature = "client-reqwest", feature = "client-ureq")))]
43compile_error!(
44    "You have to enable at least one of the available clients with the \
45    `client-reqwest` or `client-ureq` features."
46);