summaryrefslogtreecommitdiffstats
path: root/examples/stats.rs
blob: 9e14cf40a566954611cb8e3be13f082a11625c2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//  cargo run --example stats -- <container>
use shiplift::Docker;
use std::env;
use tokio::prelude::{Future, Stream};

fn main() {
    let docker = Docker::new();
    let containers = docker.containers();
    let id = env::args()
        .nth(1)
        .expect("Usage: cargo run --example stats -- <container>");
    let fut = containers
        .get(&id)
        .stats()
        .for_each(|stat| {
            println!("{:?}", stat);
            Ok(())
        })
        .map_err(|e| eprintln!("Error: {}", e));
    tokio::run(fut);
}