summaryrefslogtreecommitdiffstats
path: root/examples/volumecreate.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/volumecreate.rs')
-rw-r--r--examples/volumecreate.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/examples/volumecreate.rs b/examples/volumecreate.rs
index 83f5045..a243be6 100644
--- a/examples/volumecreate.rs
+++ b/examples/volumecreate.rs
@@ -1,8 +1,8 @@
use shiplift::{builder::VolumeCreateOptions, Docker};
use std::{collections::HashMap, env};
-use tokio::prelude::Future;
-fn main() {
+#[tokio::main]
+async fn main() {
let docker = Docker::new();
let volumes = docker.volumes();
@@ -13,15 +13,16 @@ fn main() {
let mut labels = HashMap::new();
labels.insert("com.github.softprops", "shiplift");
- let fut = volumes
+ match volumes
.create(
&VolumeCreateOptions::builder()
.name(volume_name.as_ref())
.labels(&labels)
.build(),
)
- .map(|info| println!("{:?}", info))
- .map_err(|e| eprintln!("Error: {}", e));
-
- tokio::run(fut);
+ .await
+ {
+ Ok(info) => println!("{:?}", info),
+ Err(e) => eprintln!("Error: {}", e),
+ }
}