summaryrefslogtreecommitdiffstats
path: root/examples/top.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/top.rs')
-rw-r--r--examples/top.rs16
1 files changed, 7 insertions, 9 deletions
diff --git a/examples/top.rs b/examples/top.rs
index 5fc4229..39e8ea6 100644
--- a/examples/top.rs
+++ b/examples/top.rs
@@ -1,17 +1,15 @@
use shiplift::Docker;
use std::env;
-use tokio::prelude::Future;
-fn main() {
+#[tokio::main]
+async fn main() {
let docker = Docker::new();
let id = env::args()
.nth(1)
.expect("Usage: cargo run --example top -- <container>");
- let fut = docker
- .containers()
- .get(&id)
- .top(Default::default())
- .map(|top| println!("{:#?}", top))
- .map_err(|e| eprintln!("Error: {}", e));
- tokio::run(fut);
+
+ match docker.containers().get(&id).top(Default::default()).await {
+ Ok(top) => println!("{:#?}", top),
+ Err(e) => eprintln!("Error: {}", e),
+ }
}