diff options
Diffstat (limited to 'ipfs-api/examples/get_swarm.rs')
-rw-r--r-- | ipfs-api/examples/get_swarm.rs | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/ipfs-api/examples/get_swarm.rs b/ipfs-api/examples/get_swarm.rs index 2b9fd73..2b2c238 100644 --- a/ipfs-api/examples/get_swarm.rs +++ b/ipfs-api/examples/get_swarm.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; @@ -43,9 +46,17 @@ fn main() { } }); - hyper::rt::run( - local - .and_then(|_| connected) - .map_err(|e| eprintln!("{}", e)), - ); + let fut = local + .and_then(|_| connected) + .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(()) + }) + }); } |