Use 'serde' 'derive' feature, not 'serde_derive'.

This commit is contained in:
Jeb Rosen 2020-07-19 09:12:32 -07:00 committed by Sergio Benitez
parent ddfd73d6f3
commit 31ddb0de45
14 changed files with 19 additions and 24 deletions

View File

@ -8,6 +8,5 @@ publish = false
[dependencies] [dependencies]
tokio = { version = "0.2.0", features = ["io-util"] } tokio = { version = "0.2.0", features = ["io-util"] }
rocket = { path = "../../core/lib" } rocket = { path = "../../core/lib" }
serde = "1.0" serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0" serde_json = "1.0"
serde_derive = "1.0"

View File

@ -1,15 +1,15 @@
#[macro_use] extern crate rocket; #[macro_use] extern crate rocket;
#[macro_use] extern crate serde_derive;
#[cfg(test)] mod tests; #[cfg(test)] mod tests;
use std::io; use std::io;
use tokio::io::AsyncReadExt; use rocket::tokio::io::AsyncReadExt;
use rocket::{Request, data::Data}; use rocket::{Request, data::Data};
use rocket::response::{Debug, content::{Json, Html}}; use rocket::response::{Debug, content::{Json, Html}};
use serde::{Serialize, Deserialize};
// NOTE: This example explicitly uses the `Json` type from `response::content` // NOTE: This example explicitly uses the `Json` type from `response::content`
// for demonstration purposes. In a real application, _always_ prefer to use // for demonstration purposes. In a real application, _always_ prefer to use
// `rocket_contrib::json::Json` instead! // `rocket_contrib::json::Json` instead!

View File

@ -7,8 +7,7 @@ publish = false
[dependencies] [dependencies]
rocket = { path = "../../core/lib" } rocket = { path = "../../core/lib" }
serde = "1.0" serde = { version = "1.0", features = ["derive"] }
serde_derive = "1.0"
serde_json = "1.0" serde_json = "1.0"
[dependencies.rocket_contrib] [dependencies.rocket_contrib]

View File

@ -1,5 +1,4 @@
#[macro_use] extern crate rocket; #[macro_use] extern crate rocket;
#[macro_use] extern crate serde_derive;
#[cfg(test)] mod tests; #[cfg(test)] mod tests;
@ -7,7 +6,7 @@ use rocket::Request;
use rocket::response::Redirect; use rocket::response::Redirect;
use rocket_contrib::templates::{Template, handlebars}; use rocket_contrib::templates::{Template, handlebars};
#[derive(Serialize)] #[derive(serde::Serialize)]
struct TemplateContext { struct TemplateContext {
title: &'static str, title: &'static str,
name: Option<String>, name: Option<String>,

View File

@ -7,9 +7,8 @@ publish = false
[dependencies] [dependencies]
rocket = { path = "../../core/lib" } rocket = { path = "../../core/lib" }
serde = "1.0" serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0" serde_json = "1.0"
serde_derive = "1.0"
[dependencies.rocket_contrib] [dependencies.rocket_contrib]
path = "../../contrib/lib" path = "../../contrib/lib"

View File

@ -1,6 +1,5 @@
#[macro_use] extern crate rocket; #[macro_use] extern crate rocket;
#[macro_use] extern crate rocket_contrib; #[macro_use] extern crate rocket_contrib;
#[macro_use] extern crate serde_derive;
#[cfg(test)] mod tests; #[cfg(test)] mod tests;
@ -10,6 +9,8 @@ use std::collections::HashMap;
use rocket::State; use rocket::State;
use rocket_contrib::json::{Json, JsonValue}; use rocket_contrib::json::{Json, JsonValue};
use serde::{Serialize, Deserialize};
// The type to represent the ID of a message. // The type to represent the ID of a message.
type ID = usize; type ID = usize;

View File

@ -7,8 +7,7 @@ publish = false
[dependencies] [dependencies]
rocket = { path = "../../core/lib" } rocket = { path = "../../core/lib" }
serde = "1.0" serde = { version = "1.0", features = ["derive"] }
serde_derive = "1.0"
[dependencies.rocket_contrib] [dependencies.rocket_contrib]
path = "../../contrib/lib" path = "../../contrib/lib"

View File

@ -1,10 +1,11 @@
#[macro_use] extern crate rocket; #[macro_use] extern crate rocket;
#[macro_use] extern crate serde_derive;
#[cfg(test)] mod tests; #[cfg(test)] mod tests;
use rocket_contrib::msgpack::MsgPack; use rocket_contrib::msgpack::MsgPack;
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
struct Message<'r> { struct Message<'r> {
id: usize, id: usize,

View File

@ -2,6 +2,8 @@ use crate::rocket;
use rocket::local::blocking::Client; use rocket::local::blocking::Client;
use rocket::http::{Status, ContentType}; use rocket::http::{Status, ContentType};
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
struct Message { struct Message {
id: usize, id: usize,

View File

@ -7,8 +7,7 @@ publish = false
[dependencies] [dependencies]
rocket = { path = "../../core/lib" } rocket = { path = "../../core/lib" }
serde = "1.0" serde = { version = "1.0", features = ["derive"] }
serde_derive = "1.0"
serde_json = "1.0" serde_json = "1.0"
[dependencies.rocket_contrib] [dependencies.rocket_contrib]

View File

@ -1,5 +1,4 @@
#[macro_use] extern crate rocket; #[macro_use] extern crate rocket;
#[macro_use] extern crate serde_derive;
#[cfg(test)] mod tests; #[cfg(test)] mod tests;
@ -9,7 +8,7 @@ use rocket::Request;
use rocket::response::Redirect; use rocket::response::Redirect;
use rocket_contrib::templates::Template; use rocket_contrib::templates::Template;
#[derive(Serialize)] #[derive(serde::Serialize)]
struct TemplateContext { struct TemplateContext {
name: String, name: String,
items: Vec<&'static str> items: Vec<&'static str>

View File

@ -7,9 +7,8 @@ publish = false
[dependencies] [dependencies]
rocket = { path = "../../core/lib" } rocket = { path = "../../core/lib" }
serde = "1.0" serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0" serde_json = "1.0"
serde_derive = "1.0"
diesel = { version = "1.3", features = ["sqlite", "r2d2"] } diesel = { version = "1.3", features = ["sqlite", "r2d2"] }
diesel_migrations = "1.3" diesel_migrations = "1.3"
log = "0.4" log = "0.4"

View File

@ -2,7 +2,6 @@
#[macro_use] extern crate diesel; #[macro_use] extern crate diesel;
#[macro_use] extern crate diesel_migrations; #[macro_use] extern crate diesel_migrations;
#[macro_use] extern crate log; #[macro_use] extern crate log;
#[macro_use] extern crate serde_derive;
#[macro_use] extern crate rocket_contrib; #[macro_use] extern crate rocket_contrib;
mod task; mod task;
@ -25,7 +24,7 @@ embed_migrations!();
#[database("sqlite_database")] #[database("sqlite_database")]
pub struct DbConn(SqliteConnection); pub struct DbConn(SqliteConnection);
#[derive(Debug, Serialize)] #[derive(Debug, serde::Serialize)]
struct Context<'a> { struct Context<'a> {
msg: Option<(&'a str, &'a str)>, msg: Option<(&'a str, &'a str)>,
tasks: Vec<Task> tasks: Vec<Task>

View File

@ -14,7 +14,7 @@ use self::schema::tasks;
use self::schema::tasks::dsl::{tasks as all_tasks, completed as task_completed}; use self::schema::tasks::dsl::{tasks as all_tasks, completed as task_completed};
#[table_name="tasks"] #[table_name="tasks"]
#[derive(Serialize, Queryable, Insertable, Debug, Clone)] #[derive(serde::Serialize, Queryable, Insertable, Debug, Clone)]
pub struct Task { pub struct Task {
pub id: Option<i32>, pub id: Option<i32>,
pub description: String, pub description: String,