chore(syntax): Run rustfmt on examples.

This commit is contained in:
Lewin Bormann
2019-06-09 09:25:29 +02:00
parent ce9b6d8dd7
commit aa6fb4e0b9
2 changed files with 74 additions and 44 deletions

View File

@@ -11,9 +11,11 @@ use std::path::Path;
use hyper::net::HttpsConnector;
use hyper_native_tls::NativeTlsClient;
use yup_oauth2::{Authenticator, FlowType, ApplicationSecret, DiskTokenStorage,
DefaultAuthenticatorDelegate, read_application_secret};
use google_drive3::Drive;
use yup_oauth2::{
read_application_secret, ApplicationSecret, Authenticator, DefaultAuthenticatorDelegate,
DiskTokenStorage, FlowType,
};
const CLIENT_SECRET_FILE: &'static str = "example_client_secret.json";
@@ -24,23 +26,31 @@ fn read_client_secret(file: String) -> ApplicationSecret {
fn main() {
let secret = read_client_secret(CLIENT_SECRET_FILE.to_string());
let client = hyper::Client::with_connector(
HttpsConnector::new(NativeTlsClient::new().unwrap()));
let authenticator = Authenticator::new(&secret,
DefaultAuthenticatorDelegate,
client,
DiskTokenStorage::new(&"token_store.json".to_string())
.unwrap(),
Some(FlowType::InstalledInteractive));
let client = hyper::Client::with_connector(
HttpsConnector::new(NativeTlsClient::new().unwrap()));
let client =
hyper::Client::with_connector(HttpsConnector::new(NativeTlsClient::new().unwrap()));
let authenticator = Authenticator::new(
&secret,
DefaultAuthenticatorDelegate,
client,
DiskTokenStorage::new(&"token_store.json".to_string()).unwrap(),
Some(FlowType::InstalledInteractive),
);
let client =
hyper::Client::with_connector(HttpsConnector::new(NativeTlsClient::new().unwrap()));
let hub = Drive::new(client, authenticator);
let (_resp, list_result) = hub.files().list().q("'root' in parents and trashed = false").doit().unwrap();
let (_resp, list_result) = hub
.files()
.list()
.q("'root' in parents and trashed = false")
.doit()
.unwrap();
for file in list_result.files.unwrap_or(vec![]) {
println!("{} ({})",
file.name.unwrap_or(String::new()),
file.mime_type.unwrap_or(String::new()));
println!(
"{} ({})",
file.name.unwrap_or(String::new()),
file.mime_type.unwrap_or(String::new())
);
}
}