diff options
Diffstat (limited to 'examples/networkdisconnect.rs')
-rw-r--r-- | examples/networkdisconnect.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/examples/networkdisconnect.rs b/examples/networkdisconnect.rs index 9676dc9..9c529a1 100644 --- a/examples/networkdisconnect.rs +++ b/examples/networkdisconnect.rs @@ -1,18 +1,22 @@ extern crate shiplift; +extern crate tokio; use shiplift::{ContainerConnectionOptions, Docker}; use std::env; +use tokio::prelude::Future; fn main() { let docker = Docker::new(); let networks = docker.networks(); match (env::args().nth(1), env::args().nth(2)) { - (Some(container_id), Some(network_id)) => println!( - "{:?}", - networks + (Some(container_id), Some(network_id)) => { + let fut = networks .get(&network_id) .disconnect(&ContainerConnectionOptions::new(&container_id)) - ), + .map(|v| println!("{:?}", v)) + .map_err(|e| eprintln!("Error: {}", e)); + tokio::run(fut); + } _ => eprintln!("please provide a container_id and network_id"), } } |