From 30330da11a56dfdd11bdbef50dba073a9edc36b2 Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Fri, 22 Mar 2019 15:25:42 -0700 Subject: [PATCH] chore: Fix examples not working with `cargo run` (#998) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: Fix examples not working with `cargo run` ## Motivation PR #991 moved the `tokio` crate to its own subdirectory, but did not move the `examples` directory into `tokio/examples`. While attempting to use the examples for testing another change, I noticed that #991 had broken the ability to use `cargo run`, as the examples were no longer considered part of a crate that cargo was aware of: ``` tokio on master [$] via 🦀v1.33.0 at ☸️ aks-eliza-dev ➜ cargo run --example chat error: no example target named `chat` Did you mean `echo`? ``` ## Solution This branch moves the examples into the `tokio` directory, so cargo is now once again aware of them: ``` tokio on eliza/fix-examples [$] via 🦀v1.33.0 at ☸️ aks-eliza-dev ➜ cargo run --example chat Compiling tokio-executor v0.1.7 (/Users/eliza/Code/tokio/tokio-executor) Compiling tokio-reactor v0.1.9 Compiling tokio-threadpool v0.1.13 Compiling tokio-current-thread v0.1.6 Compiling tokio-timer v0.2.10 Compiling tokio-uds v0.2.5 Compiling tokio-udp v0.1.3 Compiling tokio-tcp v0.1.3 Compiling tokio-fs v0.1.6 Compiling tokio v0.1.18 (/Users/eliza/Code/tokio/tokio) Finished dev [unoptimized + debuginfo] target(s) in 7.04s Running `target/debug/examples/chat` server running on localhost:6142 ``` Signed-off-by: Eliza Weisman Signed-off-by: Eliza Weisman --- README.md | 2 +- {examples => tokio/examples}/README.md | 0 {examples => tokio/examples}/chat-combinator-current-thread.rs | 0 {examples => tokio/examples}/chat-combinator.rs | 0 {examples => tokio/examples}/chat.rs | 0 {examples => tokio/examples}/connect.rs | 0 {examples => tokio/examples}/echo-udp.rs | 0 {examples => tokio/examples}/echo.rs | 0 {examples => tokio/examples}/hello_world.rs | 0 {examples => tokio/examples}/manual-runtime.rs | 0 {examples => tokio/examples}/print_each_packet.rs | 0 {examples => tokio/examples}/proxy.rs | 0 {examples => tokio/examples}/tinydb.rs | 0 {examples => tokio/examples}/tinyhttp.rs | 0 {examples => tokio/examples}/udp-client.rs | 0 {examples => tokio/examples}/udp-codec.rs | 0 16 files changed, 1 insertion(+), 1 deletion(-) rename {examples => tokio/examples}/README.md (100%) rename {examples => tokio/examples}/chat-combinator-current-thread.rs (100%) rename {examples => tokio/examples}/chat-combinator.rs (100%) rename {examples => tokio/examples}/chat.rs (100%) rename {examples => tokio/examples}/connect.rs (100%) rename {examples => tokio/examples}/echo-udp.rs (100%) rename {examples => tokio/examples}/echo.rs (100%) rename {examples => tokio/examples}/hello_world.rs (100%) rename {examples => tokio/examples}/manual-runtime.rs (100%) rename {examples => tokio/examples}/print_each_packet.rs (100%) rename {examples => tokio/examples}/proxy.rs (100%) rename {examples => tokio/examples}/tinydb.rs (100%) rename {examples => tokio/examples}/tinyhttp.rs (100%) rename {examples => tokio/examples}/udp-client.rs (100%) rename {examples => tokio/examples}/udp-codec.rs (100%) diff --git a/README.md b/README.md index 308fab75c..0d71bb6a8 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ fn main() { } ``` -More examples can be found [here](examples). +More examples can be found [here](tokio/examples). ## Getting Help diff --git a/examples/README.md b/tokio/examples/README.md similarity index 100% rename from examples/README.md rename to tokio/examples/README.md diff --git a/examples/chat-combinator-current-thread.rs b/tokio/examples/chat-combinator-current-thread.rs similarity index 100% rename from examples/chat-combinator-current-thread.rs rename to tokio/examples/chat-combinator-current-thread.rs diff --git a/examples/chat-combinator.rs b/tokio/examples/chat-combinator.rs similarity index 100% rename from examples/chat-combinator.rs rename to tokio/examples/chat-combinator.rs diff --git a/examples/chat.rs b/tokio/examples/chat.rs similarity index 100% rename from examples/chat.rs rename to tokio/examples/chat.rs diff --git a/examples/connect.rs b/tokio/examples/connect.rs similarity index 100% rename from examples/connect.rs rename to tokio/examples/connect.rs diff --git a/examples/echo-udp.rs b/tokio/examples/echo-udp.rs similarity index 100% rename from examples/echo-udp.rs rename to tokio/examples/echo-udp.rs diff --git a/examples/echo.rs b/tokio/examples/echo.rs similarity index 100% rename from examples/echo.rs rename to tokio/examples/echo.rs diff --git a/examples/hello_world.rs b/tokio/examples/hello_world.rs similarity index 100% rename from examples/hello_world.rs rename to tokio/examples/hello_world.rs diff --git a/examples/manual-runtime.rs b/tokio/examples/manual-runtime.rs similarity index 100% rename from examples/manual-runtime.rs rename to tokio/examples/manual-runtime.rs diff --git a/examples/print_each_packet.rs b/tokio/examples/print_each_packet.rs similarity index 100% rename from examples/print_each_packet.rs rename to tokio/examples/print_each_packet.rs diff --git a/examples/proxy.rs b/tokio/examples/proxy.rs similarity index 100% rename from examples/proxy.rs rename to tokio/examples/proxy.rs diff --git a/examples/tinydb.rs b/tokio/examples/tinydb.rs similarity index 100% rename from examples/tinydb.rs rename to tokio/examples/tinydb.rs diff --git a/examples/tinyhttp.rs b/tokio/examples/tinyhttp.rs similarity index 100% rename from examples/tinyhttp.rs rename to tokio/examples/tinyhttp.rs diff --git a/examples/udp-client.rs b/tokio/examples/udp-client.rs similarity index 100% rename from examples/udp-client.rs rename to tokio/examples/udp-client.rs diff --git a/examples/udp-codec.rs b/tokio/examples/udp-codec.rs similarity index 100% rename from examples/udp-codec.rs rename to tokio/examples/udp-codec.rs