src/bin/upload-speed.rs: code cleanup

This commit is contained in:
Dietmar Maurer 2019-05-23 07:20:05 +02:00
parent 238dd1b7ab
commit 32e1bf4260
1 changed files with 4 additions and 7 deletions

View File

@ -1,6 +1,5 @@
use failure::*; use failure::*;
use futures::*; use futures::*;
use serde_json::json;
use proxmox_backup::client::*; use proxmox_backup::client::*;
@ -11,14 +10,12 @@ fn upload_speed() -> Result<usize, Error> {
let username = "root@pam"; let username = "root@pam";
let mut client = HttpClient::new(host, username)?; let client = HttpClient::new(host, username)?;
let upgrade = client.start_backup(datastore, "host", "speedtest"); let client = client.start_backup(datastore, "host", "speedtest").wait()?;
let res = upgrade.and_then(|h2| {
println!("start upload speed test"); println!("start upload speed test");
h2.upload_speedtest() let res = client.upload_speedtest().wait()?;
}).wait()?;
Ok(res) Ok(res)
} }