Add Send bound to GetToken

This commit is contained in:
philippeitis
2022-09-29 06:34:47 +00:00
committed by GitHub
parent c56cd0c01a
commit b10bddab08

View File

@@ -793,7 +793,7 @@ pub async fn get_body_as_string(res_body: &mut hyper::Body) -> String {
// TODO: Simplify this to Option<String>
type TokenResult = std::result::Result<Option<String>, 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);
}
}