diff options
Diffstat (limited to 'examples/networkcreate.rs')
-rw-r--r-- | examples/networkcreate.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/examples/networkcreate.rs b/examples/networkcreate.rs index 30bb41c..3173ab4 100644 --- a/examples/networkcreate.rs +++ b/examples/networkcreate.rs @@ -1,20 +1,22 @@ use shiplift::{Docker, NetworkCreateOptions}; use std::env; -use tokio::prelude::Future; -fn main() { +#[tokio::main] +async fn main() { let docker = Docker::new(); let network_name = env::args() .nth(1) .expect("You need to specify a network name"); - let fut = docker + match docker .networks() .create( &NetworkCreateOptions::builder(network_name.as_ref()) .driver("bridge") .build(), ) - .map(|info| println!("{:?}", info)) - .map_err(|e| eprintln!("Error: {}", e)); - tokio::run(fut); + .await + { + Ok(info) => println!("{:?}", info), + Err(e) => eprintln!("Error: {}", e), + } } |