Mercurial > lbo > hg > async-google-apis
changeset 205:ec212287e4a3
move DerefAuth into async-google-apis-common, make multi-thread feature default
author | Daniel Boline <ddboline@gmail.com> |
---|---|
date | Mon, 22 Feb 2021 16:09:02 -0500 |
parents | 64b9c3214303 |
children | 23d41bfb0081 |
files | async-google-apis-common/Cargo.toml async-google-apis-common/src/lib.rs |
diffstat | 2 files changed, 15 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/async-google-apis-common/Cargo.toml Sun Feb 21 16:44:34 2021 -0500 +++ b/async-google-apis-common/Cargo.toml Mon Feb 22 16:09:02 2021 -0500 @@ -29,5 +29,5 @@ yup-oauth2 = "~5" [features] -default = [] +default = ["multi-thread"] multi-thread = []
--- a/async-google-apis-common/src/lib.rs Sun Feb 21 16:44:34 2021 -0500 +++ b/async-google-apis-common/src/lib.rs Mon Feb 22 16:09:02 2021 -0500 @@ -28,3 +28,17 @@ pub type Authenticator = yup_oauth2::authenticator::Authenticator<TlsConnr>; pub type TlsClient = hyper::Client<TlsConnr, hyper::Body>; pub type TlsConnr = hyper_rustls::HttpsConnector<hyper::client::HttpConnector>; + +#[cfg(feature = "multi-thread")] +pub trait DerefAuth: std::ops::Deref<Target=Authenticator> + Send + Sync {} + +#[cfg(feature = "multi-thread")] +impl<T> DerefAuth for T +where T: std::ops::Deref<Target=Authenticator> + Send + Sync {} + +#[cfg(not(feature = "multi-thread"))] +pub trait DerefAuth: std::ops::Deref<Target=Authenticator> {} + +#[cfg(not(feature = "multi-thread"))] +impl<T> DerefAuth for T +where T: std::ops::Deref<Target=Authenticator> {}