Skip to content

Commit

Permalink
Use 'serde' 'derive' feature, not 'serde_derive'.
Browse files Browse the repository at this point in the history
  • Loading branch information
jebrosen authored and SergioBenitez committed Jul 22, 2020
1 parent ddfd73d commit 31ddb0d
Show file tree
Hide file tree
Showing 14 changed files with 19 additions and 24 deletions.
3 changes: 1 addition & 2 deletions examples/content_types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ publish = false
[dependencies]
tokio = { version = "0.2.0", features = ["io-util"] }
rocket = { path = "../../core/lib" }
serde = "1.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_derive = "1.0"
6 changes: 3 additions & 3 deletions examples/content_types/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#[macro_use] extern crate rocket;
#[macro_use] extern crate serde_derive;

#[cfg(test)] mod tests;

use std::io;

use tokio::io::AsyncReadExt;

use rocket::tokio::io::AsyncReadExt;
use rocket::{Request, data::Data};
use rocket::response::{Debug, content::{Json, Html}};

use serde::{Serialize, Deserialize};

// NOTE: This example explicitly uses the `Json` type from `response::content`
// for demonstration purposes. In a real application, _always_ prefer to use
// `rocket_contrib::json::Json` instead!
Expand Down
3 changes: 1 addition & 2 deletions examples/handlebars_templates/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ publish = false

[dependencies]
rocket = { path = "../../core/lib" }
serde = "1.0"
serde_derive = "1.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

[dependencies.rocket_contrib]
Expand Down
3 changes: 1 addition & 2 deletions examples/handlebars_templates/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#[macro_use] extern crate rocket;
#[macro_use] extern crate serde_derive;

#[cfg(test)] mod tests;

use rocket::Request;
use rocket::response::Redirect;
use rocket_contrib::templates::{Template, handlebars};

#[derive(Serialize)]
#[derive(serde::Serialize)]
struct TemplateContext {
title: &'static str,
name: Option<String>,
Expand Down
3 changes: 1 addition & 2 deletions examples/json/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ publish = false

[dependencies]
rocket = { path = "../../core/lib" }
serde = "1.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_derive = "1.0"

[dependencies.rocket_contrib]
path = "../../contrib/lib"
Expand Down
3 changes: 2 additions & 1 deletion examples/json/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#[macro_use] extern crate rocket;
#[macro_use] extern crate rocket_contrib;
#[macro_use] extern crate serde_derive;

#[cfg(test)] mod tests;

Expand All @@ -10,6 +9,8 @@ use std::collections::HashMap;
use rocket::State;
use rocket_contrib::json::{Json, JsonValue};

use serde::{Serialize, Deserialize};

// The type to represent the ID of a message.
type ID = usize;

Expand Down
3 changes: 1 addition & 2 deletions examples/msgpack/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ publish = false

[dependencies]
rocket = { path = "../../core/lib" }
serde = "1.0"
serde_derive = "1.0"
serde = { version = "1.0", features = ["derive"] }

[dependencies.rocket_contrib]
path = "../../contrib/lib"
Expand Down
3 changes: 2 additions & 1 deletion examples/msgpack/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#[macro_use] extern crate rocket;
#[macro_use] extern crate serde_derive;

#[cfg(test)] mod tests;

use rocket_contrib::msgpack::MsgPack;

use serde::{Serialize, Deserialize};

#[derive(Serialize, Deserialize)]
struct Message<'r> {
id: usize,
Expand Down
2 changes: 2 additions & 0 deletions examples/msgpack/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ use crate::rocket;
use rocket::local::blocking::Client;
use rocket::http::{Status, ContentType};

use serde::{Serialize, Deserialize};

#[derive(Serialize, Deserialize)]
struct Message {
id: usize,
Expand Down
3 changes: 1 addition & 2 deletions examples/tera_templates/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ publish = false

[dependencies]
rocket = { path = "../../core/lib" }
serde = "1.0"
serde_derive = "1.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

[dependencies.rocket_contrib]
Expand Down
3 changes: 1 addition & 2 deletions examples/tera_templates/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#[macro_use] extern crate rocket;
#[macro_use] extern crate serde_derive;

#[cfg(test)] mod tests;

Expand All @@ -9,7 +8,7 @@ use rocket::Request;
use rocket::response::Redirect;
use rocket_contrib::templates::Template;

#[derive(Serialize)]
#[derive(serde::Serialize)]
struct TemplateContext {
name: String,
items: Vec<&'static str>
Expand Down
3 changes: 1 addition & 2 deletions examples/todo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ publish = false

[dependencies]
rocket = { path = "../../core/lib" }
serde = "1.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_derive = "1.0"
diesel = { version = "1.3", features = ["sqlite", "r2d2"] }
diesel_migrations = "1.3"
log = "0.4"
Expand Down
3 changes: 1 addition & 2 deletions examples/todo/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#[macro_use] extern crate diesel;
#[macro_use] extern crate diesel_migrations;
#[macro_use] extern crate log;
#[macro_use] extern crate serde_derive;
#[macro_use] extern crate rocket_contrib;

mod task;
Expand All @@ -25,7 +24,7 @@ embed_migrations!();
#[database("sqlite_database")]
pub struct DbConn(SqliteConnection);

#[derive(Debug, Serialize)]
#[derive(Debug, serde::Serialize)]
struct Context<'a> {
msg: Option<(&'a str, &'a str)>,
tasks: Vec<Task>
Expand Down
2 changes: 1 addition & 1 deletion examples/todo/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use self::schema::tasks;
use self::schema::tasks::dsl::{tasks as all_tasks, completed as task_completed};

#[table_name="tasks"]
#[derive(Serialize, Queryable, Insertable, Debug, Clone)]
#[derive(serde::Serialize, Queryable, Insertable, Debug, Clone)]
pub struct Task {
pub id: Option<i32>,
pub description: String,
Expand Down

0 comments on commit 31ddb0d

Please sign in to comment.