Remove extern crate for serde serialize

This commit is contained in:
jeff 2021-01-15 20:32:09 +00:00
parent 92c402e254
commit 2738de85db
10 changed files with 8 additions and 12 deletions

1
Cargo.lock generated
View File

@ -2485,7 +2485,6 @@ dependencies = [
"rocket_contrib",
"rust-argon2",
"serde",
"serde_derive",
"serde_json",
"sqlx",
"strum",

View File

@ -24,8 +24,7 @@ tonic-build = "0.3"
[dependencies]
tonic = "0.3"
prost = "0.6"
serde = "1.0"
serde_derive = "1.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
erased-serde = "0.3"
thiserror = "1.0"

View File

@ -37,7 +37,7 @@ fn main() {
let mut config = prost_build::Config::new();
config.btree_map(&["."]);
config.type_attribute(".", "#[derive(Serialize)]");
config.type_attribute(".", "#[derive(::serde::Serialize)]");
config.type_attribute(".", "#[serde(rename_all = \"camelCase\")]");
tonic_build::configure()

View File

@ -4,11 +4,6 @@ extern crate rocket;
#[macro_use]
extern crate rocket_contrib;
// Seemingly necessary to get serde::Serialize into scope for Prost
// code generation.
#[macro_use]
extern crate serde_derive;
use log::{error, info};
use rocket_contrib::serve::StaticFiles;
use rocket_contrib::templates::Template;

View File

@ -2,7 +2,7 @@ use crate::errors::Error;
use crate::models::proto::cofd::*;
use crate::models::users::User;
use prost::bytes::BytesMut;
use serde_derive::Serialize;
use serde::Serialize;
use strum::{EnumIter, EnumString};
/// Dynamic character data is an opaque container type that holds

View File

@ -1,6 +1,7 @@
use super::characters::CharacterDataType;
use rocket::http::RawStr;
use rocket::request::FromFormValue;
use serde::Serialize;
use std::str::FromStr;
use thiserror::Error;

View File

@ -3,7 +3,7 @@ use argon2::{self, Config, Error as ArgonError};
use rand::Rng;
use rocket::outcome::IntoOutcome;
use rocket::request::{self, FromRequest, Request};
use serde_derive::Serialize;
use serde::Serialize;
pub(crate) fn hash_password(raw_password: &str) -> Result<String, ArgonError> {
let salt = rand::thread_rng().gen::<[u8; 16]>();

View File

@ -3,6 +3,7 @@ use crate::errors::Error;
use crate::models::characters::{Character, CharacterDataType, DynCharacterData, Visibility};
use crate::models::users::User;
use rocket_contrib::templates::Template;
use serde::Serialize;
mod edit;
mod new;

View File

@ -7,6 +7,7 @@ use crate::models::{
};
use rocket::{request::Form, response::Redirect};
use rocket_contrib::templates::Template;
use serde::Serialize;
use strum::IntoEnumIterator;
/// Form submission for creating a new character.

View File

@ -4,7 +4,7 @@ use crate::models::characters::Visibility;
use crate::models::{characters::StrippedCharacter, users::User};
use rocket::response::Redirect;
use rocket_contrib::templates::Template;
use serde_derive::Serialize;
use serde::Serialize;
pub fn routes() -> Vec<rocket::Route> {
routes![index, user_index, proto_test]