From b10bddab08e3ae42a23600235e09d35a71e547bd Mon Sep 17 00:00:00 2001 From: philippeitis <33013301+philippeitis@users.noreply.github.com> Date: Thu, 29 Sep 2022 06:34:47 +0000 Subject: [PATCH] Add Send bound to GetToken --- google-apis-common/src/lib.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/google-apis-common/src/lib.rs b/google-apis-common/src/lib.rs index 3540fc9b46..65339071f1 100644 --- a/google-apis-common/src/lib.rs +++ b/google-apis-common/src/lib.rs @@ -793,7 +793,7 @@ pub async fn get_body_as_string(res_body: &mut hyper::Body) -> String { // TODO: Simplify this to Option type TokenResult = std::result::Result, oauth2::Error>; -pub trait GetToken: GetTokenClone { +pub trait GetToken: GetTokenClone + Send { /// Called whenever there is the need for an oauth token after /// the official authenticator implementation didn't provide one, for some reason. /// If this method returns None as well, the underlying operation will fail @@ -928,4 +928,13 @@ mod test_api { let dlg: &mut dyn Delegate = &mut dd; with_send(dlg); } + + #[test] + fn dyn_get_token_is_send() { + fn with_send(_x: impl Send) {} + + let mut gt = String::new(); + let dgt: &mut dyn GetToken = &mut dd; + with_send(dgt); + } }