summaryrefslogtreecommitdiffstats
path: root/examples/containercreate.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/containercreate.rs')
-rw-r--r--examples/containercreate.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/examples/containercreate.rs b/examples/containercreate.rs
index d061f70..ef579a6 100644
--- a/examples/containercreate.rs
+++ b/examples/containercreate.rs
@@ -1,16 +1,19 @@
use shiplift::{ContainerOptions, Docker};
use std::env;
-use tokio::prelude::Future;
-fn main() {
+#[tokio::main]
+async fn main() {
let docker = Docker::new();
let image = env::args()
.nth(1)
.expect("You need to specify an image name");
- let fut = docker
+
+ match docker
.containers()
.create(&ContainerOptions::builder(image.as_ref()).build())
- .map(|info| println!("{:?}", info))
- .map_err(|e| eprintln!("Error: {}", e));
- tokio::run(fut);
+ .await
+ {
+ Ok(info) => println!("{:?}", info),
+ Err(e) => eprintln!("Error: {}", e),
+ }
}