src/client/http_client.rs: use async for login()

This commit is contained in:
Dietmar Maurer 2019-09-04 10:01:46 +02:00
parent 9d35dbbb8f
commit 96f5e80abb

View File

@ -139,7 +139,7 @@ impl HttpClient {
Ok(Self { Ok(Self {
client, client,
server: String::from(server), server: String::from(server),
auth: BroadcastFuture::new(Box::new(login)), auth: BroadcastFuture::new(Box::new(login_future)),
}) })
} }
@ -147,8 +147,8 @@ impl HttpClient {
/// ///
/// Login is done on demand, so this is onyl required if you need /// Login is done on demand, so this is onyl required if you need
/// access to authentication data in 'AuthInfo'. /// access to authentication data in 'AuthInfo'.
pub fn login(&self) -> impl Future<Output = Result<AuthInfo, Error>> { pub async fn login(&self) -> Result<AuthInfo, Error> {
self.auth.listen() self.auth.listen().await
} }
fn get_password(_username: &str) -> Result<String, Error> { fn get_password(_username: &str) -> Result<String, Error> {