diff options
Diffstat (limited to 'ipfs-api/examples/get_stats.rs')
-rw-r--r-- | ipfs-api/examples/get_stats.rs | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/ipfs-api/examples/get_stats.rs b/ipfs-api/examples/get_stats.rs index 41f2a5c..9107aa3 100644 --- a/ipfs-api/examples/get_stats.rs +++ b/ipfs-api/examples/get_stats.rs @@ -6,7 +6,10 @@ // copied, modified, or distributed except according to those terms. // +#[cfg(feature = "actix")] +extern crate actix_web; extern crate futures; +#[cfg(feature = "hyper")] extern crate hyper; extern crate ipfs_api; @@ -54,10 +57,18 @@ fn main() { println!(" version : {}", repo_stats.version); }); - hyper::rt::run( - bitswap_stats - .and_then(|_| bw_stats) - .and_then(|_| repo_stats) - .map_err(|e| eprintln!("{}", e)), - ); + let fut = bitswap_stats + .and_then(|_| bw_stats) + .and_then(|_| repo_stats) + .map_err(|e| eprintln!("{}", e)); + + #[cfg(feature = "hyper")] + hyper::rt::run(fut); + #[cfg(feature = "actix")] + actix_web::actix::run(|| { + fut.then(|_| { + actix_web::actix::System::current().stop(); + Ok(()) + }) + }); } |