summaryrefslogtreecommitdiffstats
path: root/ipfs-api/examples/add_file.rs
diff options
context:
space:
mode:
authorFerris Tseng <ferristseng@fastmail.fm>2019-10-14 16:05:54 -0400
committerFerris Tseng <ferristseng@fastmail.fm>2019-10-14 16:05:54 -0400
commit0d816372dcef185fe3def9b6e4ebd3f35ac8c2b9 (patch)
tree39b12a3613fd631004e5760776306b6d9720f34b /ipfs-api/examples/add_file.rs
parent0af1aac5b6bb3d33808ee50d84db27c0634bf42c (diff)
unify runtime in examples
Diffstat (limited to 'ipfs-api/examples/add_file.rs')
-rw-r--r--ipfs-api/examples/add_file.rs19
1 files changed, 6 insertions, 13 deletions
diff --git a/ipfs-api/examples/add_file.rs b/ipfs-api/examples/add_file.rs
index 3d9be49..5f8f0c9 100644
--- a/ipfs-api/examples/add_file.rs
+++ b/ipfs-api/examples/add_file.rs
@@ -6,16 +6,14 @@
// 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 tokio;
use futures::Future;
use ipfs_api::IpfsClient;
use std::fs::File;
+use tokio::runtime::current_thread::Runtime;
// Creates an Ipfs client, and adds this source file to Ipfs.
//
@@ -30,13 +28,8 @@ 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(())
- })
- });
+ Runtime::new()
+ .expect("tokio runtime")
+ .block_on(req)
+ .expect("successful response");
}