summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFerris Tseng <ferris@navapbc.com>2019-12-24 17:52:16 -0500
committerFerris Tseng <ferris@navapbc.com>2019-12-24 17:52:16 -0500
commit25d6054562187a0d46049cc0bde49f82f0fc27a2 (patch)
treeaeccd876ff1e32b0e231abc332533718b90f9312
parent3aeb20d68f969216a127585a91eebede4911230f (diff)
use proper runtime for all examples
-rw-r--r--ipfs-api/examples/add_file.rs3
-rw-r--r--ipfs-api/examples/add_tar.rs3
-rw-r--r--ipfs-api/examples/bootstrap_default.rs3
-rw-r--r--ipfs-api/examples/dns.rs3
-rw-r--r--ipfs-api/examples/get_commands.rs3
-rw-r--r--ipfs-api/examples/get_stats.rs3
-rw-r--r--ipfs-api/examples/get_swarm.rs3
-rw-r--r--ipfs-api/examples/get_version.rs3
-rw-r--r--ipfs-api/examples/log_tail.rs3
-rw-r--r--ipfs-api/examples/mfs.rs3
-rw-r--r--ipfs-api/examples/ping_peer.rs3
-rw-r--r--ipfs-api/examples/pubsub.rs3
-rw-r--r--ipfs-api/examples/replace_config.rs3
-rw-r--r--ipfs-api/examples/resolve_name.rs3
14 files changed, 28 insertions, 14 deletions
diff --git a/ipfs-api/examples/add_file.rs b/ipfs-api/examples/add_file.rs
index 798a5f2..3015684 100644
--- a/ipfs-api/examples/add_file.rs
+++ b/ipfs-api/examples/add_file.rs
@@ -11,7 +11,8 @@ use std::fs::File;
// Creates an Ipfs client, and adds this source file to Ipfs.
//
-#[tokio::main]
+#[cfg_attr(feature = "actix", actix_rt::main)]
+#[cfg_attr(feature = "hyper", tokio::main)]
async fn main() {
eprintln!("note: this must be run in the root of the project repository");
eprintln!("connecting to localhost:5001...");
diff --git a/ipfs-api/examples/add_tar.rs b/ipfs-api/examples/add_tar.rs
index 7d2976e..0bf0eb9 100644
--- a/ipfs-api/examples/add_tar.rs
+++ b/ipfs-api/examples/add_tar.rs
@@ -13,7 +13,8 @@ use tar::Builder;
// Creates an Ipfs client, and adds this source file to Ipfs.
//
-#[tokio::main]
+#[cfg_attr(feature = "actix", actix_rt::main)]
+#[cfg_attr(feature = "hyper", tokio::main)]
async fn main() {
eprintln!("note: this must be run in the root of the project repository");
eprintln!("connecting to localhost:5001...");
diff --git a/ipfs-api/examples/bootstrap_default.rs b/ipfs-api/examples/bootstrap_default.rs
index 5a60496..adf2876 100644
--- a/ipfs-api/examples/bootstrap_default.rs
+++ b/ipfs-api/examples/bootstrap_default.rs
@@ -11,7 +11,8 @@ use ipfs_api::IpfsClient;
// Lists clients in bootstrap list, then adds the default list, then removes
// them, and readds them.
//
-#[tokio::main]
+#[cfg_attr(feature = "actix", actix_rt::main)]
+#[cfg_attr(feature = "hyper", tokio::main)]
async fn main() {
eprintln!("connecting to localhost:5001...");
diff --git a/ipfs-api/examples/dns.rs b/ipfs-api/examples/dns.rs
index 327913a..02857e0 100644
--- a/ipfs-api/examples/dns.rs
+++ b/ipfs-api/examples/dns.rs
@@ -10,7 +10,8 @@ use ipfs_api::IpfsClient;
// Creates an Ipfs client, resolves ipfs.io, and lists the contents of it.
//
-#[tokio::main]
+#[cfg_attr(feature = "actix", actix_rt::main)]
+#[cfg_attr(feature = "hyper", tokio::main)]
async fn main() {
eprintln!("connecting to localhost:5001...");
diff --git a/ipfs-api/examples/get_commands.rs b/ipfs-api/examples/get_commands.rs
index 4557b70..4aa91ce 100644
--- a/ipfs-api/examples/get_commands.rs
+++ b/ipfs-api/examples/get_commands.rs
@@ -32,7 +32,8 @@ fn print_recursive(indent: usize, cmd: &response::CommandsResponse) {
// Creates an Ipfs client, and gets a list of available commands from the
// Ipfs server.
//
-#[tokio::main]
+#[cfg_attr(feature = "actix", actix_rt::main)]
+#[cfg_attr(feature = "hyper", tokio::main)]
async fn main() {
eprintln!("connecting to localhost:5001...");
diff --git a/ipfs-api/examples/get_stats.rs b/ipfs-api/examples/get_stats.rs
index 36100a5..f6eef0f 100644
--- a/ipfs-api/examples/get_stats.rs
+++ b/ipfs-api/examples/get_stats.rs
@@ -10,7 +10,8 @@ use ipfs_api::IpfsClient;
// Creates an Ipfs client, and gets some stats about the Ipfs server.
//
-#[tokio::main]
+#[cfg_attr(feature = "actix", actix_rt::main)]
+#[cfg_attr(feature = "hyper", tokio::main)]
async fn main() {
eprintln!("connecting to localhost:5001...");
diff --git a/ipfs-api/examples/get_swarm.rs b/ipfs-api/examples/get_swarm.rs
index 60c8290..67dc70b 100644
--- a/ipfs-api/examples/get_swarm.rs
+++ b/ipfs-api/examples/get_swarm.rs
@@ -11,7 +11,8 @@ use ipfs_api::IpfsClient;
// Creates an Ipfs client, and gets information about your local address, and
// connected peers.
//
-#[tokio::main]
+#[cfg_attr(feature = "actix", actix_rt::main)]
+#[cfg_attr(feature = "hyper", tokio::main)]
async fn main() {
eprintln!("connecting to localhost:5001...");
diff --git a/ipfs-api/examples/get_version.rs b/ipfs-api/examples/get_version.rs
index d38b322..9d22988 100644
--- a/ipfs-api/examples/get_version.rs
+++ b/ipfs-api/examples/get_version.rs
@@ -10,7 +10,8 @@ use ipfs_api::IpfsClient;
// Creates an Ipfs client, and gets the version of the Ipfs server.
//
-#[tokio::main]
+#[cfg_attr(feature = "actix", actix_rt::main)]
+#[cfg_attr(feature = "hyper", tokio::main)]
async fn main() {
eprintln!("connecting to localhost:5001...");
diff --git a/ipfs-api/examples/log_tail.rs b/ipfs-api/examples/log_tail.rs
index 79c8253..79b6e65 100644
--- a/ipfs-api/examples/log_tail.rs
+++ b/ipfs-api/examples/log_tail.rs
@@ -11,7 +11,8 @@ use ipfs_api::IpfsClient;
// Tails the log of IPFS.
//
-#[tokio::main]
+#[cfg_attr(feature = "actix", actix_rt::main)]
+#[cfg_attr(feature = "hyper", tokio::main)]
async fn main() {
eprintln!("connecting to localhost:5001...");
diff --git a/ipfs-api/examples/mfs.rs b/ipfs-api/examples/mfs.rs
index b6e3c99..3d6419c 100644
--- a/ipfs-api/examples/mfs.rs
+++ b/ipfs-api/examples/mfs.rs
@@ -20,7 +20,8 @@ fn print_stat(stat: response::FilesStatResponse) {
// Creates an Ipfs client, and makes some calls to the Mfs Api.
//
-#[tokio::main]
+#[cfg_attr(feature = "actix", actix_rt::main)]
+#[cfg_attr(feature = "hyper", tokio::main)]
async fn main() {
eprintln!("note: this must be run in the root of the project repository");
eprintln!("connecting to localhost:5001...");
diff --git a/ipfs-api/examples/ping_peer.rs b/ipfs-api/examples/ping_peer.rs
index b432ef6..2934c16 100644
--- a/ipfs-api/examples/ping_peer.rs
+++ b/ipfs-api/examples/ping_peer.rs
@@ -12,7 +12,8 @@ use ipfs_api::{response::PingResponse, IpfsClient};
// Creates an Ipfs client, discovers a connected peer, and pings it using the
// streaming Api, and by collecting it into a collection.
//
-#[tokio::main]
+#[cfg_attr(feature = "actix", actix_rt::main)]
+#[cfg_attr(feature = "hyper", tokio::main)]
async fn main() {
eprintln!("connecting to localhost:5001...");
diff --git a/ipfs-api/examples/pubsub.rs b/ipfs-api/examples/pubsub.rs
index 16b674e..bed0aae 100644
--- a/ipfs-api/examples/pubsub.rs
+++ b/ipfs-api/examples/pubsub.rs
@@ -25,7 +25,8 @@ fn get_client() -> IpfsClient {
// Creates an Ipfs client, and simultaneously publishes and reads from a pubsub
// topic.
//
-#[tokio::main]
+#[cfg_attr(feature = "actix", actix_rt::main)]
+#[cfg_attr(feature = "hyper", tokio::main)]
async fn main() {
eprintln!("note: ipfs must be run with the --enable-pubsub-experiment flag");
diff --git a/ipfs-api/examples/replace_config.rs b/ipfs-api/examples/replace_config.rs
index f19c113..76cc96f 100644
--- a/ipfs-api/examples/replace_config.rs
+++ b/ipfs-api/examples/replace_config.rs
@@ -11,7 +11,8 @@ use std::io::Cursor;
// Creates an Ipfs client, and replaces the config file with the default one.
//
-#[tokio::main]
+#[cfg_attr(feature = "actix", actix_rt::main)]
+#[cfg_attr(feature = "hyper", tokio::main)]
async fn main() {
eprintln!("note: this must be run in the root of the project repository");
eprintln!("connecting to localhost:5001...");
diff --git a/ipfs-api/examples/resolve_name.rs b/ipfs-api/examples/resolve_name.rs
index 2b263d5..0d7b830 100644
--- a/ipfs-api/examples/resolve_name.rs
+++ b/ipfs-api/examples/resolve_name.rs
@@ -13,7 +13,8 @@ const IPFS_IPNS: &str = "/ipns/ipfs.io";
// Creates an Ipfs client, and resolves the Ipfs domain name, and
// publishes a path to Ipns.
//
-#[tokio::main]
+#[cfg_attr(feature = "actix", actix_rt::main)]
+#[cfg_attr(feature = "hyper", tokio::main)]
async fn main() {
eprintln!("connecting to localhost:5001...");