From 315b131cdd53ef289e942a977712f8819d30abb5 Mon Sep 17 00:00:00 2001 From: Cameron Dershem Date: Thu, 13 Jun 2019 00:32:48 -0400 Subject: [PATCH] Cargo can't do nested workspaces. --- examples/Cargo.toml | 6 +++++- examples/{front-page => }/easy-form-handling/Cargo.toml | 0 examples/{front-page => }/easy-form-handling/src/main.rs | 4 ++-- .../{front-page => }/easy-form-handling/static/form.html | 2 +- examples/{front-page => }/flexible-responders/Cargo.toml | 0 examples/{front-page => }/flexible-responders/src/main.rs | 4 ++-- examples/front-page/Cargo.toml | 8 -------- examples/{front-page => }/main-example/Cargo.toml | 2 +- examples/{front-page => }/main-example/src/main.rs | 4 ++-- examples/{front-page => }/powerful-extractors/Cargo.toml | 0 examples/{front-page => }/powerful-extractors/src/main.rs | 4 ++-- .../{front-page => }/powerful-extractors/static/form.html | 2 +- examples/{front-page => }/request-routing/Cargo.toml | 0 examples/{front-page => }/request-routing/src/main.rs | 2 +- 14 files changed, 17 insertions(+), 21 deletions(-) rename examples/{front-page => }/easy-form-handling/Cargo.toml (100%) rename examples/{front-page => }/easy-form-handling/src/main.rs (91%) rename examples/{front-page => }/easy-form-handling/static/form.html (91%) rename examples/{front-page => }/flexible-responders/Cargo.toml (100%) rename examples/{front-page => }/flexible-responders/src/main.rs (89%) delete mode 100644 examples/front-page/Cargo.toml rename examples/{front-page => }/main-example/Cargo.toml (78%) rename examples/{front-page => }/main-example/src/main.rs (87%) rename examples/{front-page => }/powerful-extractors/Cargo.toml (100%) rename examples/{front-page => }/powerful-extractors/src/main.rs (93%) rename examples/{front-page => }/powerful-extractors/static/form.html (95%) rename examples/{front-page => }/request-routing/Cargo.toml (100%) rename examples/{front-page => }/request-routing/src/main.rs (95%) diff --git a/examples/Cargo.toml b/examples/Cargo.toml index d0f5da1..444f971 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -1,8 +1,12 @@ [workspace] members = [ "application", - "front-page", + "easy-form-handling", + "flexible-responders", "getting-started", + "main-example", + "powerful-extractors", + "request-routing", "server", "url-dispatch", ] diff --git a/examples/front-page/easy-form-handling/Cargo.toml b/examples/easy-form-handling/Cargo.toml similarity index 100% rename from examples/front-page/easy-form-handling/Cargo.toml rename to examples/easy-form-handling/Cargo.toml diff --git a/examples/front-page/easy-form-handling/src/main.rs b/examples/easy-form-handling/src/main.rs similarity index 91% rename from examples/front-page/easy-form-handling/src/main.rs rename to examples/easy-form-handling/src/main.rs index 406ef8d..168b394 100644 --- a/examples/front-page/easy-form-handling/src/main.rs +++ b/examples/easy-form-handling/src/main.rs @@ -27,8 +27,8 @@ fn main() { .route("/", web::get().to(index)) .route("/register", web::post().to(register)) }) - .bind("127.0.0.1:8000") - .expect("Can not bind to port 8000") + .bind("127.0.0.1:8088") + .unwrap() .run() .unwrap(); } diff --git a/examples/front-page/easy-form-handling/static/form.html b/examples/easy-form-handling/static/form.html similarity index 91% rename from examples/front-page/easy-form-handling/static/form.html rename to examples/easy-form-handling/static/form.html index 08a2570..61ffceb 100644 --- a/examples/front-page/easy-form-handling/static/form.html +++ b/examples/easy-form-handling/static/form.html @@ -6,7 +6,7 @@ -

Will hit handle_post_1

+

Its a form.

diff --git a/examples/front-page/flexible-responders/Cargo.toml b/examples/flexible-responders/Cargo.toml similarity index 100% rename from examples/front-page/flexible-responders/Cargo.toml rename to examples/flexible-responders/Cargo.toml diff --git a/examples/front-page/flexible-responders/src/main.rs b/examples/flexible-responders/src/main.rs similarity index 89% rename from examples/front-page/flexible-responders/src/main.rs rename to examples/flexible-responders/src/main.rs index 4d23898..dbe8e28 100644 --- a/examples/front-page/flexible-responders/src/main.rs +++ b/examples/flexible-responders/src/main.rs @@ -21,8 +21,8 @@ fn main() { .service(web::resource("/").to(hello_world)) .service(web::resource("/temp").to(current_temperature)) }) - .bind("127.0.0.1:8000") - .expect("Can not bind to port 8000") + .bind("127.0.0.1:8088") + .unwrap() .run() .unwrap(); } diff --git a/examples/front-page/Cargo.toml b/examples/front-page/Cargo.toml deleted file mode 100644 index 8365d5a..0000000 --- a/examples/front-page/Cargo.toml +++ /dev/null @@ -1,8 +0,0 @@ -[workspace] -members = [ - "main-example", - "flexible-responders", - "easy-form-handling", - "request-routing", - "powerful-extractors", -] diff --git a/examples/front-page/main-example/Cargo.toml b/examples/main-example/Cargo.toml similarity index 78% rename from examples/front-page/main-example/Cargo.toml rename to examples/main-example/Cargo.toml index 96d110d..b48e677 100644 --- a/examples/front-page/main-example/Cargo.toml +++ b/examples/main-example/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "front-page" +name = "main-example" version = "0.1.0" edition = "2018" diff --git a/examples/front-page/main-example/src/main.rs b/examples/main-example/src/main.rs similarity index 87% rename from examples/front-page/main-example/src/main.rs rename to examples/main-example/src/main.rs index 4184006..e09d82d 100644 --- a/examples/front-page/main-example/src/main.rs +++ b/examples/main-example/src/main.rs @@ -12,8 +12,8 @@ fn main() { .service(web::resource("/").to(greet)) .service(web::resource("/{name}").to(greet)) }) - .bind("127.0.0.1:8000") - .expect("Can not bind to port 8000") + .bind("127.0.0.1:8088") + .unwrap() .run() .unwrap(); } diff --git a/examples/front-page/powerful-extractors/Cargo.toml b/examples/powerful-extractors/Cargo.toml similarity index 100% rename from examples/front-page/powerful-extractors/Cargo.toml rename to examples/powerful-extractors/Cargo.toml diff --git a/examples/front-page/powerful-extractors/src/main.rs b/examples/powerful-extractors/src/main.rs similarity index 93% rename from examples/front-page/powerful-extractors/src/main.rs rename to examples/powerful-extractors/src/main.rs index fec60a9..befb7a8 100644 --- a/examples/front-page/powerful-extractors/src/main.rs +++ b/examples/powerful-extractors/src/main.rs @@ -37,8 +37,8 @@ fn main() { .route("/", web::get().to(index)) .route("/event", web::post().to(capture_event)) }) - .bind("127.0.0.1:8000") - .expect("Can not bind to port 8000") + .bind("127.0.0.1:8088") + .unwrap() .run() .unwrap(); } diff --git a/examples/front-page/powerful-extractors/static/form.html b/examples/powerful-extractors/static/form.html similarity index 95% rename from examples/front-page/powerful-extractors/static/form.html rename to examples/powerful-extractors/static/form.html index 6fc8da4..a51229b 100644 --- a/examples/front-page/powerful-extractors/static/form.html +++ b/examples/powerful-extractors/static/form.html @@ -18,7 +18,7 @@ } function submitJson() { - fetch('http://localhost:8000/event', { + fetch('http://localhost:8088/event', { method: 'POST', headers: { 'Accept': 'application/json', diff --git a/examples/front-page/request-routing/Cargo.toml b/examples/request-routing/Cargo.toml similarity index 100% rename from examples/front-page/request-routing/Cargo.toml rename to examples/request-routing/Cargo.toml diff --git a/examples/front-page/request-routing/src/main.rs b/examples/request-routing/src/main.rs similarity index 95% rename from examples/front-page/request-routing/src/main.rs rename to examples/request-routing/src/main.rs index 411c9a9..fdb7f45 100644 --- a/examples/front-page/request-routing/src/main.rs +++ b/examples/request-routing/src/main.rs @@ -15,7 +15,7 @@ fn main() { .service(web::resource("/").to(index)) .service(web::resource("/{name}").to(hello)) }) - .bind("127.0.0.1:8000") + .bind("127.0.0.1:8088") .unwrap() .run() .unwrap();