diff --git a/examples/content_types/Cargo.toml b/examples/content_types/Cargo.toml index 01d88a7f..973be5bd 100644 --- a/examples/content_types/Cargo.toml +++ b/examples/content_types/Cargo.toml @@ -9,4 +9,4 @@ rocket = { path = "../../lib" } rocket_codegen = { path = "../../codegen" } serde = "0.8" serde_json = "0.8" -serde_macros = "0.8" +serde_derive = "0.8" diff --git a/examples/content_types/src/main.rs b/examples/content_types/src/main.rs index 8e5c6893..7dd0b473 100644 --- a/examples/content_types/src/main.rs +++ b/examples/content_types/src/main.rs @@ -1,8 +1,9 @@ -#![feature(plugin, custom_derive)] -#![plugin(rocket_codegen, serde_macros)] +#![feature(plugin, rustc_macro)] +#![plugin(rocket_codegen)] extern crate rocket; extern crate serde_json; +#[macro_use] extern crate serde_derive; use rocket::{Rocket, Request, Error}; use rocket::http::ContentType; @@ -26,18 +27,14 @@ fn hello(content_type: ContentType, name: String, age: i8) -> data::JSON } #[error(404)] -fn not_found<'r>(error: Error, request: &'r Request<'r>) -> String { - match error { - Error::BadMethod if !request.content_type().is_json() => { - format!("

This server only supports JSON requests, not '{}'.

", - request.content_type()) - } - Error::NoRoute => { - format!("

Sorry, '{}' is not a valid path!

+fn not_found<'r>(_: Error, request: &'r Request<'r>) -> String { + if !request.content_type().is_json() { + format!("

This server only supports JSON requests, not '{}'.

", + request.content_type()) + } else { + format!("

Sorry, '{}' is not a valid path!

Try visiting /hello/<name>/<age> instead.

", request.uri()) - } - _ => format!("

Bad Request

"), } } diff --git a/examples/handlebars_templates/Cargo.toml b/examples/handlebars_templates/Cargo.toml index 18907952..d11180a3 100644 --- a/examples/handlebars_templates/Cargo.toml +++ b/examples/handlebars_templates/Cargo.toml @@ -8,7 +8,7 @@ workspace = "../../" rocket = { path = "../../lib" } rocket_codegen = { path = "../../codegen" } serde = "*" -serde_macros = "*" +serde_derive = "*" serde_json = "*" [dependencies.rocket_contrib] diff --git a/examples/handlebars_templates/src/main.rs b/examples/handlebars_templates/src/main.rs index fb01b211..a75296da 100644 --- a/examples/handlebars_templates/src/main.rs +++ b/examples/handlebars_templates/src/main.rs @@ -1,9 +1,10 @@ -#![feature(plugin, custom_derive)] -#![plugin(rocket_codegen, serde_macros)] +#![feature(plugin, rustc_macro)] +#![plugin(rocket_codegen)] extern crate rocket_contrib; extern crate rocket; extern crate serde_json; +#[macro_use] extern crate serde_derive; use rocket::{Rocket, Request, Error}; use rocket::response::Redirect; diff --git a/examples/json/Cargo.toml b/examples/json/Cargo.toml index bdfefb7d..7d16802d 100644 --- a/examples/json/Cargo.toml +++ b/examples/json/Cargo.toml @@ -9,7 +9,7 @@ rocket = { path = "../../lib" } rocket_codegen = { path = "../../codegen" } serde = "*" serde_json = "*" -serde_macros = "*" +serde_derive = "*" lazy_static = "*" [dependencies.rocket_contrib] diff --git a/examples/json/src/main.rs b/examples/json/src/main.rs index 3b9483d3..e2fb565e 100644 --- a/examples/json/src/main.rs +++ b/examples/json/src/main.rs @@ -1,10 +1,11 @@ -#![feature(plugin, custom_derive)] -#![plugin(rocket_codegen, serde_macros)] +#![feature(plugin, rustc_macro)] +#![plugin(rocket_codegen)] -#[macro_use] extern crate lazy_static; -#[macro_use] extern crate rocket_contrib; extern crate rocket; extern crate serde_json; +#[macro_use] extern crate lazy_static; +#[macro_use] extern crate rocket_contrib; +#[macro_use] extern crate serde_derive; use rocket::{Rocket, Request, Error}; use rocket_contrib::JSON; diff --git a/examples/todo/Cargo.toml b/examples/todo/Cargo.toml index 8643c57d..79869237 100644 --- a/examples/todo/Cargo.toml +++ b/examples/todo/Cargo.toml @@ -10,7 +10,7 @@ rocket_codegen = { path = "../../codegen" } lazy_static = "*" serde = "0.8" serde_json = "0.8" -serde_macros = "0.8" +serde_derive = "0.8" diesel = { git = "https://github.com/SergioBenitez/diesel", features = ["sqlite"] } diesel_codegen = { git = "https://github.com/SergioBenitez/diesel", default_features = false, features = ["sqlite"] } diff --git a/examples/todo/src/main.rs b/examples/todo/src/main.rs index cd6da89e..f7f1836a 100644 --- a/examples/todo/src/main.rs +++ b/examples/todo/src/main.rs @@ -1,11 +1,12 @@ -#![feature(plugin, custom_derive, custom_attribute)] -#![plugin(rocket_codegen, serde_macros, diesel_codegen)] +#![feature(plugin, custom_derive, custom_attribute, rustc_macro)] +#![plugin(rocket_codegen, diesel_codegen)] extern crate rocket; +extern crate serde_json; #[macro_use] extern crate diesel; #[macro_use] extern crate lazy_static; #[macro_use] extern crate rocket_contrib; -extern crate serde_json; +#[macro_use] extern crate serde_derive; mod static_files; mod task;