From 4bdebbf4d1d1edb839eba860b013e3fdb870f66e Mon Sep 17 00:00:00 2001 From: Sameer Puri Date: Sat, 9 Feb 2019 14:34:00 -0600 Subject: Add actix feature for using actix-web --- ipfs-api/examples/add_file.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'ipfs-api/examples/add_file.rs') diff --git a/ipfs-api/examples/add_file.rs b/ipfs-api/examples/add_file.rs index d771966..3d9be49 100644 --- a/ipfs-api/examples/add_file.rs +++ b/ipfs-api/examples/add_file.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; @@ -27,5 +30,13 @@ fn main() { .map(|add| println!("added file: {:?}", add)) .map_err(|e| eprintln!("{}", e)); + #[cfg(feature = "hyper")] hyper::rt::run(req); + #[cfg(feature = "actix")] + actix_web::actix::run(|| { + req.then(|_| { + actix_web::actix::System::current().stop(); + Ok(()) + }) + }); } -- cgit v1.2.3