diff options
author | Ferris Tseng <ferristseng@fastmail.fm> | 2019-10-14 16:05:54 -0400 |
---|---|---|
committer | Ferris Tseng <ferristseng@fastmail.fm> | 2019-10-14 16:05:54 -0400 |
commit | 0d816372dcef185fe3def9b6e4ebd3f35ac8c2b9 (patch) | |
tree | 39b12a3613fd631004e5760776306b6d9720f34b /ipfs-api/examples/add_tar.rs | |
parent | 0af1aac5b6bb3d33808ee50d84db27c0634bf42c (diff) |
unify runtime in examples
Diffstat (limited to 'ipfs-api/examples/add_tar.rs')
-rw-r--r-- | ipfs-api/examples/add_tar.rs | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/ipfs-api/examples/add_tar.rs b/ipfs-api/examples/add_tar.rs index 5d75e28..b737812 100644 --- a/ipfs-api/examples/add_tar.rs +++ b/ipfs-api/examples/add_tar.rs @@ -6,18 +6,16 @@ // 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; extern crate tar; +extern crate tokio; use futures::{Future, Stream}; use ipfs_api::IpfsClient; use std::io::Cursor; use tar::Builder; +use tokio::runtime::current_thread::Runtime; // Creates an Ipfs client, and adds this source file to Ipfs. // @@ -55,13 +53,8 @@ fn main() { }) .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(()) - }) - }); + Runtime::new() + .expect("tokio runtime") + .block_on(req) + .expect("successful response"); } |