changeset 210:3f7f119b8a26

let upload_file take immutable reference
author Daniel Boline <ddboline@gmail.com>
date Mon, 22 Feb 2021 16:41:01 -0500
parents 23a0e172a3a5
children 403ea731228b
files example_crates/drive_example/src/main.rs
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/example_crates/drive_example/src/main.rs	Mon Feb 22 16:26:20 2021 -0500
+++ b/example_crates/drive_example/src/main.rs	Mon Feb 22 16:41:01 2021 -0500
@@ -24,7 +24,7 @@
 }
 
 /// Upload a local file `f` to your drive.
-async fn upload_file(mut cl: drive::FilesService, f: &Path) -> anyhow::Result<()> {
+async fn upload_file(cl: &drive::FilesService, f: &Path) -> anyhow::Result<()> {
     let fname = f.file_name().unwrap().to_str().unwrap();
 
     let mut general_params = drive::DriveParams::default();
@@ -120,7 +120,7 @@
 
     let arg = std::env::args().skip(1).next();
     if let Some(fp) = arg {
-        upload_file(cl, Path::new(&fp))
+        upload_file(&cl, Path::new(&fp))
             .await
             .expect("Upload failed :(");
     } else {